Flask Tutorial

Flask is a lightweight Python web framework built on a very different philosophy from Django: instead of shipping every piece for you, Flask gives you a small, solid core — routing, request handling, and Jinja2 templating — and lets you add exactly the pieces your project actually needs, as extensions, one at a time. This track covers 37 lessons, from your first route through templates, forms, a real database layer with SQLAlchemy, user authentication, blueprints for structuring larger apps, building a REST API, testing, and deployment. Throughout the whole track we build one running example together — Bookshelf, a personal reading tracker where users log books, organize them onto shelves, and tag them — so every concept lands in a real, connected context rather than isolated snippets.

Where this fits: This track assumes you've been through Core Python (variables, functions, classes, OOP) — if any of that feels shaky, the Core Python track is a good foundation first.

What Makes Flask Different

Compared to...Flask's approach
DjangoFlask is a "microframework" — routing and templating ship built in, but the database layer, forms, and login system are all separate packages you choose and wire in yourself
A framework with a mandatory project layoutFlask doesn't force a folder structure on you — a whole working app can be a single file, and you grow the structure as the project grows
An all-in-one ORM/admin/auth bundleFlask's ecosystem is a collection of small, focused extensions (Flask-SQLAlchemy, Flask-Login, Flask-WTF) that you compose together instead of inheriting one fixed stack

A Quick Look Ahead

Example: A Route Rendering a Template

# app.py
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/books')
def book_list():
    books = Book.query.filter_by(status='reading').all()
    return render_template('books/list.html', books=books)
Note: This is correct, real Flask code — but this website's own project doesn't run a Flask server, so you won't see it actually execute on this page. Follow along by creating your own project after the next few setup pages.

What You'll Learn In This Track

AreaCovered in
FoundationsInstallation, your first app, project structure, the app factory pattern, configuration
Routing & requestsRoutes, dynamic URLs, the request/response objects, error handling
TemplatesJinja2, template inheritance, custom filters, static files
Forms & stateFlask-WTF, validation & CSRF, file uploads, sessions, flash messages
The data layerFlask-SQLAlchemy, models & relationships, migrations, CRUD, querying & pagination
ArchitectureBlueprints, the application context, and Flask's globals
Users & securityFlask-Login, registration & password hashing, authorization, email, security best practices
Building APIs & shipping itREST APIs, Marshmallow & JWT, testing, caching, background tasks, deployment
Next steps: Head to Why Flask? before we install anything — understanding the philosophy makes everything after it click faster.