Between Django and nothing
In 2010 Python web is dominated by Django (“batteries-included” framework, ORM, admin, forms, auth), web.py, Pylons/TurboGears. Missing, however, is a minimal, modular option suited to microservices or small APIs. Armin Ronacher, author of Werkzeug (WSGI toolkit) and Jinja2 (template engine), publishes on 1 April 2010, as a joke, a microframework called Flask. It turns out so solid that it becomes serious.
The release
Flask 0.1 is released on 16 April 2010. BSD-3-Clause licence. Built on:
- Werkzeug — WSGI utilities, routing
- Jinja2 — template engine
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "Hello, World!"
if __name__ == "__main__":
app.run(debug=True)
Three lines for a working web server.
Philosophy
- Microframework — minimal core, extensible via optional libraries
- Unopinionated — no imposed ORM, no mandatory project structure
- Decorator routing —
@app.route("/path")intuitive - Context locals —
request,session,gaccessible globally but thread-safe - Blueprints — modular organisation in large apps
- Native Jinja2 — powerful server-side templates
Extensions
The Flask ecosystem grows enormously:
- Flask-SQLAlchemy — ORM integration
- Flask-Login, Flask-Security — authentication
- Flask-Migrate — Alembic migrations
- Flask-WTF — forms with CSRF
- Flask-RESTful, Flask-RESTX — REST APIs
- Flask-SocketIO — WebSocket
Adoption
Flask has been the preferred framework for:
- Small and medium REST APIs
- Python microservices
- Rapid prototyping
- ML model serving before FastAPI
- Educational applications
Many famous Python projects were written in Flask: Pinterest (in part), LinkedIn (some internal tools), Netflix (some services), Reddit (some sections).
In the Italian context
Flask is entering many Italian companies doing data analysis and Python prototyping. Microservices and small REST APIs are the typical use case.
References: Flask 0.1 (16 April 2010). Armin Ronacher. BSD-3-Clause licence. Built on Werkzeug and Jinja2. Flask-SQLAlchemy, Flask-Login, Flask-RESTful ecosystem.
