Introduction
Deploying a Django app involves configuring it for production — setting up a WSGI server, static file serving, a production database, and environment variables.
Deployment checklist
- Set
DEBUG = False - Configure
ALLOWED_HOSTS - Set up a production database (PostgreSQL)
- Configure static files with
collectstatic - Use environment variables for secrets
- Set up HTTPS
- Use Gunicorn as the WSGI server
Deployment platforms
Popular options for deploying Django apps:
- Railway — Simple, modern PaaS
- Render — Free tier available
- Fly.io — Container-based deployment
- DigitalOcean — VPS for more control
- Heroku — Classic PaaS option
Assignment
- Configure your Django project for production.
- Deploy your blog application to a hosting platform.
- Set up a PostgreSQL database for production.