🌍 Python · subject

Python Flask Syllabus

Every chapter and topic of Flask examined in Python — 6 chapters, 17 topics and 44 sub-topics, plus 50 flashcards written against it.

6Chapters
17Topics
44Sub-topics
~20hEst. first pass
7%Of Python
50Flashcards

Flask syllabus — full chapter and topic list

Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Flask in Python, not a summary of it.

  1. Introduction to Flask

    3 topics
    • Overview
      • What is Flask?
      • History of Flask
      • Flask vs Other Frameworks
    • Installation
      • Setting up a Virtual Environment
      • Installing Flask via pip
    • First Flask Application
      • Creating a Simple Application
      • Running the Application
      • Understanding Flask Application Structure
  2. Core Concepts

    3 topics
    • Routing
      • URL Routing
      • Variable Rules
      • HTTP Methods
    • Templates
      • Jinja2 Templating Engine
      • Template Inheritance
      • Rendering Templates
      • Template Context
    • Static Files
      • Serving Static Files
      • Configuring Static File Paths
  3. Advanced Concepts

    3 topics
    • Forms
      • Handling Forms
      • WTForms Integration
      • Form Validation
    • Database Integration
      • SQLAlchemy
      • Flask-SQLAlchemy
      • Database Migrations with Flask-Migrate
    • Authentication
      • Flask-Login
      • User Registration
      • User Authentication
      • Password Hashing
  4. Deployment

    3 topics
    • Production Environment
      • Configuring for Production
      • Using a WSGI Server
    • Hosting Options
      • Deploying on Heroku
      • Deploying on AWS
      • Deploying on DigitalOcean
    • Containerization
      • Dockerizing a Flask Application
      • Using Docker Compose
  5. Testing

    2 topics
    • Unit Testing
      • Writing Unit Tests
      • Using Flask's Testing Client
    • Integration Testing
      • Setting up Integration Tests
      • Testing Application Endpoints
  6. Best Practices

    3 topics
    • Application Structure
      • Organizing Flask Projects
      • Blueprints
    • Configuration Management
      • Environment-based Configuration
      • Using Config Files
    • Security
      • Preventing Common Vulnerabilities
      • Using Flask-Security

Flask flashcards for Python

18 of 50 cards from the Flask deck — real questions with worked answers.

  1. What is Flask and how is it classified among web frameworks?

    Flask is a lightweight WSGI web framework for Python. It is classified as a 'micro-framework' because it keeps its core minimal (routing + request/response) and leaves features like database access, form validation, and authentication to extensions rather than bundling them.

  2. On which two core libraries is Flask built?

    Flask is built on Werkzeug (a WSGI utility library that handles requests, responses, and routing) and Jinja2 (the template engine for rendering HTML).

  3. What does WSGI stand for and what is its role relative to Flask?

    WSGI = Web Server Gateway Interface. It is the standard Python interface between web servers and web applications. Flask is a WSGI application; a WSGI server (e.g. Gunicorn) calls the Flask app to handle each request.

  4. What is the difference between a micro-framework like Flask and a full-stack framework like Django?

    Flask (micro) ships a minimal core and adds functionality via optional extensions, giving flexibility and less convention. Django (full-stack) is 'batteries-included' with a built-in ORM, admin, forms, and auth, enforcing more structure and convention out of the box.

  5. What is the recommended way to install Flask in isolation, and the command to create and activate a virtual environment?

    Use a Python virtual environment to isolate dependencies. Create it with `python -m venv venv`, then activate with `source venv/bin/activate` (Linux/macOS) or `venv\Scripts\activate` (Windows). Install Flask with `pip install Flask`.

  6. Why should each Flask project use its own virtual environment?

    To isolate package dependencies and versions per project, preventing conflicts between projects and keeping the global Python installation clean and reproducible (capturable via `pip freeze > requirements.txt`).

  7. Write the minimal 'first Flask application' code.

    ```python from flask import Flask app = Flask(__name__) @app.route('/') def hello(): return 'Hello, World!' ``` Then run with `flask run` or `app.run()`.

  8. What is the purpose of passing `__name__` to `Flask(__name__)`?

    `__name__` tells Flask the import name of the application module so it can locate resources like the `templates/` and `static/` folders relative to that module.

  9. What are the two common ways to start the Flask development server?

    1) The CLI: set `FLASK_APP=app.py` then run `flask run`. 2) In code: call `app.run()` inside a `if __name__ == '__main__':` guard. Add `debug=True` (or `FLASK_DEBUG=1`) to enable the debugger and auto-reload.

  10. What does enabling debug mode (`debug=True`) do in Flask?

    It activates the interactive in-browser debugger (showing tracebacks) and the automatic reloader that restarts the server on code changes. It must be turned OFF in production for security.

  11. What is routing in Flask and which decorator defines a route?

    Routing maps a URL path to a Python view function. The `@app.route('/path')` decorator binds a URL rule to the function that should handle requests to that URL.

  12. How do you define a dynamic URL segment with a type converter in a Flask route?

    Use angle brackets with an optional converter: `@app.route('/user/<int:user_id>')`. Built-in converters include `string` (default), `int`, `float`, `path`, and `uuid`. The captured value is passed as a function argument.

  13. How do you restrict a Flask route to specific HTTP methods?

    Pass the `methods` list to the decorator: `@app.route('/submit', methods=['GET', 'POST'])`. By default a route only accepts GET (and implicitly HEAD/OPTIONS).

  14. What does Flask's `url_for()` function do, and why is it preferred over hardcoding URLs?

    `url_for('endpoint', **values)` builds a URL by the view function's name (endpoint) rather than a literal path. It is preferred because it survives route changes, handles escaping, and correctly builds static/blueprint URLs.

  15. Which template engine does Flask use, and what function renders a template?

    Flask uses Jinja2. Templates are rendered with `render_template('page.html', **context)`, which looks for the file in the `templates/` folder and passes context variables to it.

  16. In Jinja2, what is the difference between `{{ ... }}` and `{% ... %}`?

    `{{ expression }}` outputs (prints) the evaluated value into the template. `{% statement %}` is for control logic like `if`, `for`, `block`, and `extends` that produces no direct output.

  17. How does Jinja2 template inheritance work?

    A base template defines overridable regions with `{% block content %}{% endblock %}`. A child template starts with `{% extends 'base.html' %}` and redefines those blocks. This promotes DRY layouts (shared header/footer).

  18. What is autoescaping in Jinja2 and why does it matter for security?

    Jinja2 automatically escapes HTML special characters (`<`, `>`, `&`, quotes) in `{{ }}` output for `.html` templates, preventing cross-site scripting (XSS). Use the `|safe` filter only on trusted content to bypass it.

See more Flask flashcards →

Planning Flask for Python

Flask is about 7% of the Python syllabus by topic count — 17 of 242 topics, spread over 6 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 20 hours.

The heaviest chapters are Introduction to Flask (3 topics), Core Concepts (3 topics), Advanced Concepts (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.

Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.

Flask (Python) FAQ

What is in the Python Flask syllabus?

Flask is split into 6 chapters — Introduction to Flask, Core Concepts, Advanced Concepts, Deployment, Testing and Best Practices, containing 17 topics and 44 sub-topics in total.

How is Flask structured in the Python syllabus?

6 chapters. Flask accounts for about 7% of the topics in the whole Python syllabus (17 of 242).

How long should I spend on Flask for Python?

Budget around 20 hours for a first pass through Flask — about 45 minutes per topic plus 12 minutes per sub-topic across its 17 topics. Add revision cycles on top.

Are there flashcards for Python Flask?

Yes — a 50-card Flask deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.