Flask is an amazing Python micro-framework for building web applications. Flask has been stable and production-ready for a long time now and a few days ago its maintainers released version 1.0 of the project to better reflect its stability status.
We couldn't be more excited about this, so we are making it super-easy to get started with Flask 1.0 at SourceLair by just visiting https://lair.io/sourcelair/flask and creating your project with one click.
Our favorite Flask 1.0 updates
More flexible application discovery
Discovering which Flask application to run via the Flask CLI is much more flexible now with the FLASK_APP
environment variable. Starting with Flask 1.0, developers can define which Flask application they want to run in four different ways:
FLASK_APP=src/hello
: Sets the current working directory tosrc
then importshello
.FLASK_APP=hello.web
: Imports the pathhello.web
.FLASK_APP=hello:app
: Uses theapp2
Flask instance inhello
.FLASK_APP="hello:create_app('dev')"
: Thecreate_app
factory inhello
is called with the string'dev'
as the argument.
Multi-threaded development server
Starting with Flask 1.0 the development server can handle concurrent requests by utilising multiple threads. This is super useful, as it boosts your application performance in development, e.g. when multiple users intensively use your Flask app for evaluation or testing purposes.
Last, it's worth mentioning that Flask 1.0 drops support for Python 2.6 and 3.4, although this is not affecting SourceLair users at all, since we only provide the latest Python 3.6 and 2.7 versions.
If you are interested to read the full list of updates packed with Flask 1.0, feel free to take a look at the official Flask 1.0 release blog post.