Skip to content

Phase 9 - Deployment

Deployment is where many Flask apps break because development and production environments behave differently.

This phase teaches a practical deployment mental model:

  • your Flask app is a WSGI app
  • Gunicorn runs it with multiple workers
  • Nginx sits in front as a reverse proxy
  • configuration comes from environment variables
  • Preparing for production
  • Environment variables and .env
  • Gunicorn
  • Nginx as reverse proxy
  • Dockerizing a Flask app
  • Deploying to Render
  • Deploying to PythonAnywhere
  • Deploying to AWS EC2
  1. Preparing for Production
  2. Environment Variables (.env)
  3. Gunicorn Web Server
  4. Using Nginx as Reverse Proxy
  5. Dockerizing Flask App
  6. Deploying to Render
  7. Deploying to PythonAnywhere
  8. Deploying to AWS EC2

This phase exists to run the app somewhere other than your laptop. It assumes an application you are ready to expose, and once it is done you can build all of it, running on a public server.

diagram Diagram mermaid
sketch The track, and what each phase unlocks p5.js
Each phase assumes the one before it. Click a phase to see what you can build once it is done.
#page
1Preparing for Production
2Environment Variables (.env)
3Gunicorn Web Server
4Using Nginx as Reverse Proxy
5Dockerizing Flask App
6Deploying to Render
7Deploying to PythonAnywhere
8Deploying to AWS EC2

8 pages. They are ordered so that each one only uses ideas from the pages above it — reading out of order mostly works, but the examples assume what came before.

pch.quizTag pch.quizDefaultTitle
  1. Why is the Flask development server not used in production?

    pch.quizShowAnswer

    B — it is single-process by default, unhardened, and prints a warning saying so — Werkzeug prints the warning on every start. Gunicorn or uWSGI runs the app, and Nginx usually sits in front of it.

  2. Why do Environment Variables come before any hosting page in this phase?

    pch.quizShowAnswer

    B — every deployment target needs the same thing: configuration and secrets supplied from outside the code — Render, PythonAnywhere, Docker and EC2 differ in how you supply them, not in whether you need them. Learning the principle once makes each host a detail.

  3. What do the phase overview pages give you that the individual pages do not?

    pch.quizShowAnswer

    B — the reading order, what the phase assumes, and what you can build once it is done — Each overview lists its pages in sidebar order and names the phase's prerequisites and outcome, so you can tell whether you are ready for it.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading