Wagtail CMS
Elegant Django-based CMS with powerful page editing features.
Overview
Wagtail CMS is an elegant, Django-based content management system developed by Torchbox that emphasizes powerful page editing through its innovative StreamField technology. Unlike traditional CMSs that lock content into rigid templates, Wagtail provides a block-based editing interface that allows content creators to build rich, structured pages using reusable components while maintaining clean, semantic markup. Built on Django's robust foundation, Wagtail inherits Django's security model, ORM capabilities, and extensive ecosystem while adding sophisticated content management features like hierarchical page trees, workflow management, and multi-site support.
This Docker stack combines Wagtail with PostgreSQL 16 to create a production-ready content management platform that leverages PostgreSQL's advanced features for content storage and search capabilities. PostgreSQL's JSONB support is particularly valuable for Wagtail's StreamField data, which stores complex block structures as JSON while maintaining queryability and performance. The database's full-text search capabilities integrate directly with Wagtail's built-in search framework, eliminating the need for external search solutions in many scenarios.
This combination is ideal for organizations requiring a developer-friendly CMS that doesn't sacrifice editorial experience for technical flexibility. Marketing teams, digital agencies, and content-heavy applications benefit from Wagtail's intuitive editing interface, while developers appreciate the Django foundation that allows custom functionality without fighting against CMS limitations. The PostgreSQL backend ensures data integrity and provides the performance characteristics needed for high-traffic publishing environments.
Key Features
- StreamField block-based content editing with drag-and-drop page composition
- Hierarchical page tree with URL routing and site structure management
- Built-in image and document management with automatic format generation and focal point selection
- PostgreSQL JSONB storage for StreamField data enabling complex queries on block content
- Integrated search using PostgreSQL's full-text search with customizable ranking and filtering
- Multi-site management from single Wagtail installation with domain-based routing
- Workflow system with content moderation, scheduled publishing, and revision history
- Django admin integration alongside Wagtail's custom admin interface for complete site management
Common Use Cases
- 1Corporate websites with complex content structures and multiple content editors
- 2Digital agency client sites requiring custom functionality built on Django framework
- 3News and media publications needing workflow management and scheduled publishing
- 4E-commerce sites using Wagtail for content pages with Django handling transactional functionality
- 5Educational institutions managing multiple department sites from single installation
- 6Government and non-profit organizations requiring WCAG compliance and structured content
- 7Multi-language websites leveraging Wagtail's internationalization capabilities with PostgreSQL collation support
Prerequisites
- Docker and Docker Compose installed with minimum 2GB RAM available for containers
- Basic understanding of Django concepts including models, views, and URL routing
- Familiarity with PostgreSQL administration for database maintenance and optimization
- Port 8000 available for Wagtail web interface access
- Environment variables configured: DB_PASSWORD and SECRET_KEY (50+ character random string)
- Understanding of Python package management if extending Wagtail with custom applications
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 wagtail: 3 image: wagtail/wagtail:latest4 container_name: wagtail5 restart: unless-stopped6 environment: 7 DATABASE_URL: postgres://wagtail:${DB_PASSWORD}@postgres:5432/wagtail8 SECRET_KEY: ${SECRET_KEY}9 volumes: 10 - media_data:/app/media11 ports: 12 - "8000:8000"13 depends_on: 14 - postgres15 networks: 16 - wagtail-network1718 postgres: 19 image: postgres:16-alpine20 container_name: wagtail-postgres21 environment: 22 POSTGRES_USER: wagtail23 POSTGRES_PASSWORD: ${DB_PASSWORD}24 POSTGRES_DB: wagtail25 volumes: 26 - postgres_data:/var/lib/postgresql/data27 networks: 28 - wagtail-network2930volumes: 31 media_data: 32 postgres_data: 3334networks: 35 wagtail-network: 36 driver: bridge.env Template
.env
1DB_PASSWORD=changeme2SECRET_KEY=your-secret-key-hereUsage Notes
- 1Docs: https://docs.wagtail.org/
- 2Access at http://localhost:8000, admin at /admin
- 3Create superuser: docker exec -it wagtail python manage.py createsuperuser
- 4StreamField: flexible block-based content editing
- 5Built on Django: full access to Django ORM and ecosystem
- 6Image/document management, search built-in
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
wagtail
wagtail:
image: wagtail/wagtail:latest
container_name: wagtail
restart: unless-stopped
environment:
DATABASE_URL: postgres://wagtail:${DB_PASSWORD}@postgres:5432/wagtail
SECRET_KEY: ${SECRET_KEY}
volumes:
- media_data:/app/media
ports:
- "8000:8000"
depends_on:
- postgres
networks:
- wagtail-network
postgres
postgres:
image: postgres:16-alpine
container_name: wagtail-postgres
environment:
POSTGRES_USER: wagtail
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: wagtail
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- wagtail-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 wagtail:5 image: wagtail/wagtail:latest6 container_name: wagtail7 restart: unless-stopped8 environment:9 DATABASE_URL: postgres://wagtail:${DB_PASSWORD}@postgres:5432/wagtail10 SECRET_KEY: ${SECRET_KEY}11 volumes:12 - media_data:/app/media13 ports:14 - "8000:8000"15 depends_on:16 - postgres17 networks:18 - wagtail-network1920 postgres:21 image: postgres:16-alpine22 container_name: wagtail-postgres23 environment:24 POSTGRES_USER: wagtail25 POSTGRES_PASSWORD: ${DB_PASSWORD}26 POSTGRES_DB: wagtail27 volumes:28 - postgres_data:/var/lib/postgresql/data29 networks:30 - wagtail-network3132volumes:33 media_data:34 postgres_data:3536networks:37 wagtail-network:38 driver: bridge39EOF4041# 2. Create the .env file42cat > .env << 'EOF'43DB_PASSWORD=changeme44SECRET_KEY=your-secret-key-here45EOF4647# 3. Start the services48docker compose up -d4950# 4. View logs51docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/wagtail/run | bashTroubleshooting
- Wagtail container exits with database connection error: Ensure PostgreSQL container is fully initialized before Wagtail starts, add healthcheck or wait script
- Static files not loading in production: Mount additional volume for static files and run collectstatic management command in container
- StreamField blocks not saving properly: Check PostgreSQL JSONB column constraints and ensure adequate database connection pool size
- Image uploads failing with permission errors: Verify media_data volume permissions and container user ID matches volume ownership
- Search functionality returning no results: Rebuild search index using 'update_index' management command after content migration
- Admin interface CSS broken: Ensure STATIC_URL and STATIC_ROOT are properly configured in Django settings for container environment
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download