← Flask learning pathFlask · Module 10 of 10
Deploying Flask
Run Flask in production with gunicorn, Docker and cloud hosts.
📖 Key ideas
- Use gunicorn: gunicorn -w 4 "app:create_app()".
- Put Nginx in front for HTTPS and static files.
- Keep secrets in environment variables (.env never in Git).
- Containerise with Docker; deploy to Render, Railway, AWS or Cloud Run.
- Add logging and error monitoring (Sentry).
💡 Real-life example: gunicorn is a team of waiters; Nginx is the doorman managing who enters.
gunicornProduction WSGI server
NginxReverse proxy and web server
-w 4Number of worker processes
SentryError monitoring service