add error pages

This commit is contained in:
Tobias Brunner 2025-02-28 17:19:03 +01:00
parent 43f00dbaa7
commit 6cfbc516f8
No known key found for this signature in database
6 changed files with 87 additions and 0 deletions

View file

@ -1,8 +1,16 @@
from django.conf import settings
from django.conf.urls import handler400, handler404, handler500
from django.conf.urls.static import static
from django.contrib import admin
from django.shortcuts import render
from django.urls import path, include
from hub.services.views.errors import bad_request, page_not_found, server_error
handler400 = "hub.services.views.errors.bad_request"
handler404 = "hub.services.views.errors.page_not_found"
handler500 = "hub.services.views.errors.server_error"
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("hub.services.urls")),
@ -12,5 +20,8 @@ if settings.DEBUG:
urlpatterns += [
path("__reload__/", include("django_browser_reload.urls")),
path("schema-viewer/", include("schema_viewer.urls")),
path("test-400/", lambda request: render(request, "400.html"), name="test_400"),
path("test-404/", lambda request: render(request, "404.html"), name="test_404"),
path("test-500/", lambda request: render(request, "500.html"), name="test_500"),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)