Introduction
The Wagtail Bakery Demo is designed to be deployed on various platforms with flexible infrastructure options. This guide covers the deployment strategies, infrastructure requirements, and platform-specific considerations.Deployment Options
The project supports multiple deployment strategies:Docker
Deploy using Docker containers with docker-compose for local or cloud environments
Heroku
One-click deployment to Heroku with automated builds and releases
Infrastructure Requirements
Core Services
The Wagtail Bakery Demo requires the following services to run in production:PostgreSQL Database
Version: PostgreSQL 18.1 or higher recommendedThe application uses PostgreSQL as its primary database. Configure via the
DATABASE_URL environment variable.Redis Cache (Optional but Recommended)
Version: Redis 8.4 or higher recommendedRedis is used for caching and session storage to improve performance. Configure via
REDIS_URL or REDIS_TLS_URL.If Redis is not available, the application will fall back to Django’s local memory cache backend.
Python Runtime
Version: Python 3.12The application is built and tested with Python 3.12. Ensure your deployment environment supports this version.
Optional Services
Elasticsearch (Search)
Elasticsearch (Search)
Purpose: Enhanced search capabilitiesConfigure Elasticsearch for advanced search features:Supports AWS Elasticsearch with authentication via AWS credentials.
Cloud Storage (AWS S3 / Google Cloud Storage)
Cloud Storage (AWS S3 / Google Cloud Storage)
Purpose: Media file storageFor AWS S3:For Google Cloud Storage:
Cloudflare (CDN/Cache Purging)
Cloudflare (CDN/Cache Purging)
Purpose: Frontend cache purgingConfigure Cloudflare for automatic cache purging when content is published:
Environment Configuration
Required Environment Variables
These variables must be set for production deployments:| Variable | Description | Example |
|---|---|---|
DJANGO_SECRET_KEY | Django secret key for cryptographic signing | your-secret-key-here |
DATABASE_URL | PostgreSQL connection string | postgres://user:pass@host/db |
DJANGO_SETTINGS_MODULE | Django settings module | bakerydemo.settings.production |
Optional Environment Variables
| Variable | Description | Default |
|---|---|---|
REDIS_URL | Redis connection string | None (falls back to local memory) |
DJANGO_ALLOWED_HOSTS | Comma-separated list of allowed hosts | * |
PRIMARY_HOST | Primary domain for admin emails | None |
DJANGO_DEBUG | Enable debug mode (should be off in production) | off |
Deployment Architecture
Container-Based Deployment
The Docker-based deployment architecture:Platform-as-a-Service Deployment
For Heroku and similar PaaS platforms:Security Considerations
Basic Authentication
Optionally enable basic authentication for staging environments:Static Files and Media
Static Files
Static files are handled by WhiteNoise with compression and manifest storage:- Storage Backend:
whitenoise.storage.CompressedManifestStaticFilesStorage - Collection: Static files are collected during the Docker build process
- Serving: Efficiently served by WhiteNoise middleware
Media Files
Media files (user uploads, images) can be stored:- Local Volume (Docker): Mounted at
/code/bakerydemo/media/ - AWS S3: Configure with
AWS_STORAGE_BUCKET_NAME - Google Cloud Storage: Configure with
GS_BUCKET_NAME
For production deployments with multiple instances, use cloud storage (S3 or GCS) to ensure media files are accessible across all instances.
Next Steps
Docker Setup
Learn how to deploy with Docker and docker-compose
Heroku Deployment
Deploy to Heroku in minutes
Production Settings
Understand production configuration options
Getting Started
Start with local development first

