Skip to content

Commit ac0069f

Browse files
Add dev routes for 404 and 500 pages
1 parent d922caf commit ac0069f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cdhweb/urls.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
# wagtail paths
7979
path("cms/", include(wagtailadmin_urls)),
8080
path("documents/", include(wagtaildocs_urls)),
81-
# let wagtail handle everything else
82-
path("", include(wagtail_urls)),
8381
]
8482

8583
if settings.DEBUG:
@@ -90,10 +88,22 @@
9088
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
9189
urlpatterns += staticfiles_urlpatterns()
9290

91+
# Serve 404 and 500 page templates(seeing as errors are masked with debug)
92+
urlpatterns.extend(
93+
[
94+
path("404/", TemplateView.as_view(template_name="404.html")),
95+
path("500/", TemplateView.as_view(template_name="500.html")),
96+
]
97+
)
9398
try:
9499
import debug_toolbar
95100

96101
# must come before wagtail catch-all route or else debug urls 404
97102
urlpatterns.insert(0, path("__debug__/", include(debug_toolbar.urls)))
98103
except ImportError:
99104
pass
105+
106+
urlpatterns.append(
107+
# let wagtail handle everything else
108+
path("", include(wagtail_urls)),
109+
)

0 commit comments

Comments
 (0)