Flask, a tiny framework with clear ideas
A very flexible tool to create complex and performing web infrastructures in Python
The word that best describes Flask, according to the authors themselves, is "micro", which isn't intended as a statement about the framework limitations but rather to underline its most important aspect, lightness; and even if it appears quite "thin", there are several hooks that allow developers to customize most of its behaviours in order to achieve their exact goal.
The community is obviously not comparable in terms of size with other high level framework's ones, but it has already released lots of useful addons that can be used by those who choose Flask to power their projects; moreover, the core team reviews the extensions that are released every day just to be sure that none of them would ever be disruptive for the official releases.
Flask is not intended to be used "as-is", it's not something that end users can install and use, and will not offer pre-packaged solutions to problems but rather requires the developer to find the best solution for its case, which is very much unlike all the end-users frameworks out there: if you choose to use some sort of ORM, if you want to associate to users some capabilities via a permissions-roles matrix, if you want to cache some specific URLS, etc, you have to develop or integrate an existing solution in order to include it within your Flask project.
You won't find any high level builtin solution for most of the problems you will face during development, but you will be offered with a set of tools to achieve your goals without having to make compromises. From the official documentation:
“As your codebase grows, you are free to make the design decisions appropriate for your project. Flask will continue to provide a very simple glue layer to the best that Python has to offer. You can implement advanced patterns in SQLAlchemy or another database tool, introduce non-relational data persistence as appropriate, and take advantage of framework-agnostic tools built for WSGI, the Python web interface.”
Now it should be clear that if you choose to use Flask you'll have to develop what you need (as stated previously, there is already a nice set of extensions that you can use to assemble your solution; you can find them here), and you have to develop it taking into account all the aspects that could be involved, like security and performance. This implies, in terms of project management, an additional "immediate cost" that makes Flask a suitable tool (not the only one, of course) to develop customized, performing and extensible enterprise web applications that should be in your full control; and with whom you can achieve pretty much any integration need that might arise without having to deal with restrictions that a bigger framework might impose upon you.
A very good documentation
Anyone who approaches Flask for the very first time will immediately notice its very good documentation, largely thanks to its structure, which is layed out to help both the novice and the expert programmer, showcasing the various parts of the framework, from the basics up to advanced cases and deployment matters.
This last point is quite revealing of Flask's nature: even in the first pages of the documentation you can find interesting information about Heroku or Google App Engine deployment, suggestions about Fabric deployment, and even the dispatching of different instances of the same application (with different configurations) upon different URLs.
These problems are generally only faced when deploying large, verticalized, and complex applications (or sets thereof).
Last, but not least, users can download documentation in several formats (PDF, ePub, .mobi).
It's quite interesting to discover the best practices that you have to apply to write good Flask code: starting from the good old "Hello World!" you are taken through advanced concepts like Blueprints, Application Factories (a technique to instantiate the same Flask application with different configuration) and Application Dispatchers (a way to mash-up at a WSGI level two or more different applications, like Django, Flask, Tornado).
But, is it affordable ?
In my opinion, there are several considerations to make before deciding if Flask is appropriate for the project at hand.
The most important, in my opinion, are the pregressed abilities of the development team with different (and maybe bigger) frameworks.
For example, here in Abstract, we have been using Zope & Plone for 7 years and, 3 years ago, we started also using Django & Satchmo.
The adoption of one of this two frameworks (and relative applications) allows us to achieve a higher development speed and a more certain final result in respect of any (to us) unkown framework; even if, after reaching the goal, we end up with a solution that might be slightly oversized when compared to the actual requirements.
But it has happened that, in certain scenarios, such tools (and this is especially true for customizations of pre-existing applications) reveal serious limits, especially when faced with extreme scalabilty, performance, and integration capabilities.
In these scenarios, integrating too many heterogenous tools can create critical bottlenecks, which will impact the performance of the whole infrastructure severely, and in extreme cases cause the infrastructure collapse.
Therefore, even if we remember the well known academic adagio "don't reinvent the wheel", implementing some components from the bottom (which Flask allows and sometimes forces you to do) enables the developer to have full control on how each module scales and runs even in stressing environments.
Regarding that, a couple of projects that are in the design and prototyping stage here in Abstract and concern Continuous Integration and Continuous Deployment, are being built upon solutions like Flask and Tornado, which we think can best suite our needs in these projects.
If you are interested, at EuroPython 2012 there will be several talks about Flask. See you there!