All topics / Flask From Zero

Flask From Zero

Learn the Python micro-framework that teaches you what a framework's minimum really is: routing and views, Jinja2 templates, forms and request data, databases via Flask-SQLAlchemy, blueprints and the app-factory pattern, sessions and auth, building a JSON API, and testing and deployment. Small core, your choices on top.

  1. What Flask Is & Your First App Flask is the micro-framework: a small core of routing, requests, and Jinja templates, with everything else left to extensions you choose. Install it, write a tiny app, run it, and meet decorator routing.
  2. Routing & Views How Flask turns a URL into a response: dynamic URL segments with converters, branching on HTTP methods, reading the request object, returning the right kind of response, and keeping views thin.
  3. Templates with Jinja2 How Flask turns data into HTML with Jinja2: rendering templates, the Jinja language, the context you pass, template inheritance for shared layout, and the auto-escaping that quietly blocks XSS.
  4. Forms & Request Data Take in user-submitted data the right way: read raw form fields, apply the POST/redirect/GET pattern, validate and flash messages, then graduate to Flask-WTF for form classes, validators, and built-in CSRF protection.
  5. Working with a Database Flask ships no ORM — you add one. Wire in Flask-SQLAlchemy, define a Note model, do CRUD through the session, and watch Flask's add-an-extension philosophy work in the open.
  6. Blueprints & the App Factory One app.py stops scaling. Flask's answer is blueprints (modular route groups) plus the app factory — a create_app() function that wires extensions and breaks the classic circular-import trap.
  7. Sessions, Auth & Extensions Flask's session is a signed cookie; real login is an extension you add. Wire Flask-Login into the notes app, protect note-creation with @login_required, and see the ecosystem that keeps Flask small.
  8. Building a JSON API with Flask Turn your notes app into a JSON API: return jsonify instead of templates, read request bodies, set status codes, serve JSON errors, and decide honestly when Flask fits versus FastAPI.
  9. Testing & Production Test your notes app in-process with Flask's test client and a pytest app-factory fixture, then ship it for real — behind gunicorn, not the dev server — with safe production config and a minimal Dockerfile.
  10. Where to Go Next You can build a structured, database-backed, authenticated, tested, deployable Flask app and a JSON API. Now meet the extension landscape, the async truth, an honest framework map, and what to build next.