by eevilspock · 10y ago · 0 comments
> Flask is a “microframework” for Python, and is an excellent choice for building smaller applications, APIs, and web services.
> Flask is default choice for any Python web application that isn’t a good fit for Django.
Not very helpful. What is the threshold between "smaller" and larger applications? What makes an app not "a good fit for Django"? I've never found clear answers to these questions, mostly just vague opinion. This Hitchhiker's Guide, a self-proclaimed opinionated guide, could really take off if it got some opinion and backed it up with real rationale.
and, when you compare sqlalchemy to django's ORM -- Sqlalchemy is more powerful. i can't give specific reasons why. I think zzzeek is just insanely focused and that beat out design by committee. (mitsuhiko too incidentally). maybe that's wrong, just my intuition. sqlalchemy is probably the best orm in _any_ language.
there's a huge django community that would disagree, but you don't see concrete reasons why django is better than flask, but flask is better than django for the simple reasons i mention.
they're not different meant for large and small apps. everything django can do flask can do better, cleaner, simpler.
More like children of the same era. Django is older.
I would choose Pyramid over Django if I want to customize and do everything myself. Whereas if I want a very active and very mature community of plugins, I would stick with Django. When it comes to a secure framework out of the box, Django is definitely the winner out of all Python web framework.
My reasoning is that any project that needs as much as Django has built-in is going to need the custom work you put into a Pyramid project anyway, so you might as well start off there and use a nicer API from the get-go. Anything less is Flask territory from my point of view.
I started web development using Django, then tried Pyramid, and finally moved on to Flask. And since picking up Flask, I haven't gone back...and I wouldn't go back to "heavier" frameworks...although I have considered taking a peak at a couple other micro-frameworks.
I have a couple strong (personal) reasons for this (read: YMMV), but the biggest thing for me is I see web development moving towards a strict separation between front-end and back-end (SPA's, web assembly, microservices, etc.) as well as multi-model/multi-storage. Neither of which lend itself well to all-inclusive framework solutions IMO.
At the end of the day I guess the take away is to remember that it's great to have so many strong frameworks each with its own strengths to choose from in the Python ecosystem.
If you think "golly gosh, maybe some abstraction between the database and the code, hell, maybe even one of those wonderful Model View Controller things, whatever they are, would be great fun" then probably go for django or any other MVC framework
Flask can do all that, but it requires your help to achieve it. You get control over what ties with what. Django is already set up for usage, just put your code in one of three boxes, and done, but you can't decide what those boxes are or how to use them. It brings a standard structure but you lose control.