Ashish Pitrodafield notes
All episodes

Wagtail Unboxed episode 02 7:51

Opening the box: every file explained

The wagtail start command generates 29 files. Most tutorials explain three of them. We read all of them, because the ones you are told to ignore decide how your site behaves.

What this episode covers

The highlight is the data migration that quietly created your homepage. Nobody opens 0002_create_homepage.py, and it explains the page tree, content types and Wagtail's multi-site model all at once, including why your homepage's database row has a path of 00010001.

Also covered: Wagtail is about eleven Django apps in INSTALLED_APPS, and that is the whole mental model; why the wagtail_urls catch-all must be the last URL pattern; PROJECT_DIR against BASE_DIR, and STATIC_ROOT against STATICFILES_DIRS against MEDIA_ROOT; the settings split into dev.py, production.py and the local.py escape hatch; two settings that ship as broken placeholders; and a real inconsistency, where the generated requirements.txt caps Django below 6.1 but pip installs 6.1.1.

No code is written this episode. Read the box before you rebuild it.

Chapters

  1. 0:00 29 files, and why we're reading all of them
  2. 0:20 No code today
  3. 0:32 manage.py and the settings split
  4. 0:51 PROJECT_DIR vs BASE_DIR
  5. 1:07 INSTALLED_APPS
  6. 1:13 Wagtail is just Django apps
  7. 1:31 The one middleware addition
  8. 1:46 Static vs media
  9. 2:09 The Wagtail settings block
  10. 2:36 dev.py, production.py, and local.py
  11. 3:01 urls.py
  12. 3:06 Why the catch-all must be last
  13. 3:30 HomePage(Page) — six lines
  14. 3:51 How templates find themselves
  15. 4:10 The migration nobody opens
  16. 4:30 Inside the migration
  17. 4:48 Treebeard: what “00010001” means
  18. 5:22 Two pages, not one
  19. 5:38 The Site row
  20. 5:54 The search app
  21. 6:13 base.html and the Wagtail userbar
  22. 6:30 The requirements.txt discrepancy
  23. 7:02 Five things to remember
  24. 7:31 Next episode

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.

Next: episode 03, The page model and the tree

Carry on from here.

Episode 03 or see all episodes