I'm trying to get two different Wagtail sites to have their own 404 pages, but there does not appear to be a way to specify which page to use as 404 page in a "site" config in the wagtail "settings" => "sites" section, and I can't seem to get the correct 404 to be loaded when I put them into the app directories involved:
codebase/
./__init__.py
./manage.py
./apps/
./settings.py
./urls.py
...
./django-app-1/
./django-app-2/
./templates/
./404.html
./mainsite/
./migrations/
./static/
./templates/
./mainsite/
./404.html (this 404 always gets used)
./spinoff/
./migrations/
./static/
./templates/
./spinoff/
./404.html (this file never gets used)
So in INSTALLED_APPS
we have:
INSTALLED_APPS = [
...django apps...
...wagtail apps...
'apps.mainsite',
'apps.spinoff',
]
In this, the main site has the vast bulk of all the page types, and the spinoff site, which runs on a different domain, uses those page types by importing them from apps.mainsite
.
In Wagtail we have two pages that work as root: a Homepage
that is a mainsite
Page type, and a Spinoff Homepage
that is a spinof
Page type that inherits from the mainsite's page type.
In the sites settings, we have one site entry that points to mainsite.com
, with the main Homepage
set as Root, and another site entry that points to spinoff.com
, with the spinoff homepage set as root.
For both of these sites, an non-existent url request leads to the main site's 404.html getting used, so the question is: how do we make non-existent urls on the spinoff domain resolve to the spinoff's 404.html instead?