Skip to content

Commit

Permalink
Add dev routes for 404 and 500 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
haydngreatnews committed Jun 11, 2024
1 parent d922caf commit ac0069f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cdhweb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
# wagtail paths
path("cms/", include(wagtailadmin_urls)),
path("documents/", include(wagtaildocs_urls)),
# let wagtail handle everything else
path("", include(wagtail_urls)),
]

if settings.DEBUG:
Expand All @@ -90,10 +88,22 @@
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += staticfiles_urlpatterns()

# Serve 404 and 500 page templates(seeing as errors are masked with debug)
urlpatterns.extend(
[
path("404/", TemplateView.as_view(template_name="404.html")),
path("500/", TemplateView.as_view(template_name="500.html")),
]
)
try:
import debug_toolbar

# must come before wagtail catch-all route or else debug urls 404
urlpatterns.insert(0, path("__debug__/", include(debug_toolbar.urls)))
except ImportError:
pass

urlpatterns.append(
# let wagtail handle everything else
path("", include(wagtail_urls)),
)

0 comments on commit ac0069f

Please sign in to comment.