Make error views only available in dev mode
All checks were successful
Tests / test (push) Successful in 24s
All checks were successful
Tests / test (push) Successful in 24s
This commit is contained in:
parent
357fea64d1
commit
55c64d74ff
2 changed files with 16 additions and 16 deletions
|
@ -1,4 +1,3 @@
|
|||
from django.conf import settings
|
||||
from django.urls import include, path
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
|
@ -70,18 +69,4 @@ urlpatterns = [
|
|||
),
|
||||
),
|
||||
path("", RedirectView.as_view(pattern_name="frontend:profile"), name="index"),
|
||||
# Error page URLs available in all environments
|
||||
path(
|
||||
"error404/",
|
||||
views.custom_404,
|
||||
{"exception": Exception("Test 404")},
|
||||
name="error_404",
|
||||
),
|
||||
path(
|
||||
"error403/",
|
||||
views.custom_403,
|
||||
{"exception": Exception("Test 403")},
|
||||
name="error_403",
|
||||
),
|
||||
path("error500/", views.custom_500, name="error_500"),
|
||||
]
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.urls import path
|
|||
from django.urls.conf import include
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from servala.frontend import urls
|
||||
from servala.frontend import urls, views
|
||||
|
||||
admin.site.site_title = _("Servala Admin")
|
||||
admin.site.site_header = _("Servala Management")
|
||||
|
@ -26,6 +26,21 @@ urlpatterns = [
|
|||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
urlpatterns += [
|
||||
path(
|
||||
"error404/",
|
||||
views.custom_404,
|
||||
{"exception": Exception("Test 404")},
|
||||
name="error_404",
|
||||
),
|
||||
path(
|
||||
"error403/",
|
||||
views.custom_403,
|
||||
{"exception": Exception("Test 403")},
|
||||
name="error_403",
|
||||
),
|
||||
path("error500/", views.custom_500, name="error_500"),
|
||||
]
|
||||
|
||||
# Custom error handlers
|
||||
handler404 = "servala.frontend.views.custom_404"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue