42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from django.conf import settings
|
|
from django.urls import include, path
|
|
|
|
#from django.contrib import admin
|
|
from django.views.generic import RedirectView
|
|
|
|
from .core import admin
|
|
|
|
urlpatterns = [
|
|
path("", RedirectView.as_view(url="/admin")),
|
|
path("admin/", admin.admin_site.urls),
|
|
path("nested_admin/", include("nested_admin.urls")),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
from django.conf.urls.static import static
|
|
from django.views import defaults as default_views
|
|
|
|
# This allows the error pages to be debugged during development, just visit
|
|
# these url in browser to see how these error pages look like.
|
|
urlpatterns += [
|
|
path(
|
|
"400/",
|
|
default_views.bad_request,
|
|
kwargs={"exception": Exception("Bad Request!")},
|
|
),
|
|
path(
|
|
"403/",
|
|
default_views.permission_denied,
|
|
kwargs={"exception": Exception("Permission Denied")},
|
|
),
|
|
path(
|
|
"404/",
|
|
default_views.page_not_found,
|
|
kwargs={"exception": Exception("Page not Found")},
|
|
),
|
|
path("500/", default_views.server_error),
|
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
if "debug_toolbar" in settings.INSTALLED_APPS:
|
|
urlpatterns.insert(0, path("__debug__/", include("debug_toolbar.urls")))
|