I keep getting asked this question every now and then:
Which Python framework do you prefer and why?
I answered it a little while back on Quora, so now I am posting that answer here, since it seemed like it should have been a blog post.
It really depends on your needs; but in my development experience using Django and Flask I found both to be equally capable (a non-answer, yes, I know). Where they differ is in the flexibility and the amount of control handed to you.
Django is good, if you are looking for an all-in-one-it-does-everything framework. With this perspective, you are stuck with the core parts (ORM, etc.) that you can’t change easily. However, this frees you from having to worry about piecing parts together to get your app out to the public and thus you focus more on the app itself. With Django you can extend functionality by adding apps (Django promotes decoupling from the get-go) that encapsulate common functionality you will otherwise have to roll on your own.
Based on Werkzeug (“toolkit for WSGI apps”) and Jinja 2 (Templates), Flask is another one of the great frameworks, a micro-framework, but don’t let that fool you. There is nothing ‘micro’ about its capabilities. It is just as powerful. All other functionality is provided by way of extensions and you are free to incorporate any that you may require from the already existing ones or you are free to roll your own.
Flask’s minimalist approach is daunting if you are coming from an all-in-one framework, like Django, but you soon begin to appreciate the virtues (or rather “good intentions”) of this approach and realize that it is a major strength of Flask that it is giving you all this control over how you will build your app. To me, personally, that has been a very joyous experience. Once I have gotten the hang of Flask (highly recommend reading the docs and trying out the sample apps), the time to market (or 1.0) between developing an app with Flask and Django is about the same; granted you should have a clear idea of what you are doing.
The Flask approach carriers a side-benefit that if you are already using components, like SQLAlchemy or MongoKit, etc. for your ORM layer, you can do that™! You can easily incorporate them with your apps without pulling your hair out (something that is difficult/very involved to do with Django, although not impossible).
I realize this is not extensive, and I would highly recommend that you go to the sites for both Flask and Django and see what kind of apps the community is churning out with these frameworks. It will give you a better idea of what each framework is capable of creating.
Lately I have been building all my in house web services using Flask. It’s lightweight, has a well thought out API, and it scales really well too.
Bottom line is that I would say use both. Django and Flask are wonderful frameworks and they can help you scratch almost every web app itch that you may need to scratch.