Ashish Pitrodafield notes
All episodes

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.py does 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.E005 error, 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

  1. 0:00 What wagtail start gave us
  2. 0:21 The Dockerfile runs dev settings
  3. 0:45 Fail closed
  4. 1:17 Everything from the environment
  5. 1:41 One variable for the database
  6. 2:01 Postgres fails before connecting
  7. 2:29 No collectstatic: every page 500
  8. 2:47 collectstatic
  9. 3:11 The 404 page, finally
  10. 3:23 WhiteNoise and hashed filenames
  11. 3:51 Media is not static
  12. 4:15 HTTPS behind a proxy
  13. 4:48 check --deploy
  14. 5:01 The requirements the Dockerfile installs
  15. 5:25 What isn't verified yet
  16. 5:46 Commit and tag
  17. 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.

More episodes are coming

New episodes are added to the series as they are published.

The channel or see all episodes