blender-id/blenderid/urls.py

36 lines
1.5 KiB
Python

"""Blender ID URLs."""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.flatpages import views as fp_views
from django.urls import path, re_path, include
import bid_main.views.errors as error_views
urlpatterns = [
re_path(r"^admin/doc/", include("django.contrib.admindocs.urls")),
re_path(r"^admin/", include("loginas.urls")),
re_path(r"^admin/", admin.site.urls),
re_path(r"", include("bid_addon_support.urls", namespace="addon_support")),
re_path(r"^oauth/", include("blenderid.oauth2_urls", namespace="oauth2_provider")),
re_path(r"^api/", include("bid_api.urls", namespace="bid_api")),
re_path(r"", include("bid_main.urls", namespace="bid_main")),
]
handler400 = error_views.ErrorView.as_view(template_name="errors/400.html", status=400)
handler403 = error_views.ErrorView.as_view(template_name="errors/403.html", status=403)
handler404 = error_views.ErrorView.as_view(template_name="errors/404.html", status=404)
handler500 = error_views.ErrorView.as_view(template_name="errors/500.html", status=500)
if settings.DEBUG:
urlpatterns += [
path("__debug__/", include('debug_toolbar.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += [
# Flatpages must be last!
re_path(r"^(?P<url>.*/?)", fp_views.flatpage),
]