Wagtail Unboxed episode 13 6:06
Production settings
Getting the studio site ready for production, and five things the generated project gets wrong, every one measured with DEBUG off.
What this episode covers
The Dockerfile that wagtail start creates runs the DEVELOPMENT settings: DEBUG on, any host, and the secret key committed to git. Forget collectstatic and every page, even the admin login, is a 500. Point DATABASE_URL at Postgres and it fails before connecting. And uploaded images stop working entirely.
Said plainly: there is no Postgres server on the recording machine, so a live Postgres connection isn't shown here. It happens against the real host in episode 14.
What you'll learn
- What the generated
production.pydoes and doesn't do (it has no SECRET_KEY) - Why the generated Dockerfile runs dev settings, and failing closed
- Secrets and hosts from environment variables
- DATABASE_URL with dj-database-url, and SQLite as the local default
- The
postgres.E005error, and a 10-second connect timeout - "Missing staticfiles manifest entry" — the 500 on every page
WhiteNoise, hashed filenames and ten-year caching- Why media stops working with DEBUG off
- HTTPS behind a proxy, secure cookies and a deliberately short HSTS
- check --deploy: from 6 issues to 2
- The requirements file the Dockerfile really installs
Chapters
- 0:00 What wagtail start gave us
- 0:21 The Dockerfile runs dev settings
- 0:45 Fail closed
- 1:17 Everything from the environment
- 1:41 One variable for the database
- 2:01 Postgres fails before connecting
- 2:29 No collectstatic: every page 500
- 2:47 collectstatic
- 3:11 The 404 page, finally
- 3:23 WhiteNoise and hashed filenames
- 3:51 Media is not static
- 4:15 HTTPS behind a proxy
- 4:48 check --deploy
- 5:01 The requirements the Dockerfile installs
- 5:25 What isn't verified yet
- 5:46 Commit and tag
- 5:49 Next: deploy it
Versions on screen
Wagtail 7.4.3 · Django 6.1.1 · Python 3.12. Recorded on Windows; macOS and Linux commands are in the repository for every episode.