Flask Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The reference material consulted while preparing these pages is listed in the section bibliography.

A single-page, colour-coded summary of the Flask essentials, written against Flask 3.1.3, Werkzeug 3.1.9 and Python 3.10+ (versions verified 2026-10-07) — how to install and run an app (flask --app ... run --debug and .flaskenv), the application factory and project layout, the configuration loaders and the key settings, the two contexts and the order of the request lifecycle, routing, converters and url_for, request data, responses and JSON, error handlers and hooks, blueprints, Jinja essentials, sessions and flashing, Flask-WTF and CSRF, Flask-SQLAlchemy 2.0-style queries with db.paginate, Flask-Migrate commands, Flask-Login and Flask-JWT-Extended, the security settings (SECRET_KEY_FALLBACKS, TRUSTED_HOSTS, cookie flags and request limits), the flask-smorest decorators, the CLI and signals, the Celery pattern, async, gevent and Quart, streaming and Server-Sent Events, pytest fixtures, Gunicorn, Waitress, nginx and ProxyFix, and a strip of what changed since older tutorials and books, with a table mapping each outdated idiom to the current code — handy for quick memorization or as a downloadable PDF desk reference.

For the full explanation, every option, and additional examples, see the dedicated pages:

Start here — Python Flask.

Async, streaming and real-time — Async, gevent & Quart and Streaming & Server-Sent Events.

Beyond the basics — Integrating LLM APIs and What’s Changed & Migration.

References

The PDF summarizes the official documentation; each source is cited in full on the page listed above that covers it, and in the section bibliography.