nk20/note_kfet/urls.py

63 lines
2.0 KiB
Python
Raw Permalink Normal View History

2020-02-18 20:30:26 +00:00
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
2019-07-08 09:08:07 +00:00
# SPDX-License-Identifier: GPL-3.0-or-later
2019-07-07 20:49:02 +00:00
2020-03-07 21:28:59 +00:00
from django.conf import settings
from django.conf.urls.static import static
2019-07-08 09:08:07 +00:00
from django.urls import path, include
2020-04-25 17:29:18 +00:00
from django.views.defaults import bad_request, permission_denied, page_not_found, server_error
2019-07-08 09:08:07 +00:00
from django.views.generic import RedirectView
2019-07-07 20:49:02 +00:00
2020-03-19 15:12:52 +00:00
from member.views import CustomLoginView
from .admin import admin_site
2019-07-07 20:49:02 +00:00
urlpatterns = [
2019-07-17 11:34:07 +00:00
# Dev so redirect to something random
path('', RedirectView.as_view(pattern_name='note:transfer'), name='index'),
# Include project routers
path('note/', include('note.urls')),
2020-03-01 16:16:38 +00:00
path('accounts/', include('member.urls')),
2020-04-05 03:17:28 +00:00
path('registration/', include('registration.urls')),
2020-03-01 16:16:38 +00:00
path('activity/', include('activity.urls')),
2020-03-20 23:30:49 +00:00
path('treasury/', include('treasury.urls')),
2020-04-11 01:37:06 +00:00
path('wei/', include('wei.urls')),
2019-07-08 09:08:07 +00:00
# Include Django Contrib and Core routers
path('i18n/', include('django.conf.urls.i18n')),
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin_site.urls, name="admin"),
2020-03-19 15:12:52 +00:00
path('accounts/login/', CustomLoginView.as_view()),
path('accounts/', include('django.contrib.auth.urls')),
2020-02-06 22:29:17 +00:00
path('api/', include('api.urls')),
path('permission/', include('permission.urls')),
2020-08-10 13:36:41 +00:00
# Make coffee
path('coffee/', include('django_htcpcp_tea.urls')),
2019-07-07 20:49:02 +00:00
]
2020-03-03 13:24:07 +00:00
# During development, serve media files
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2020-03-08 22:03:35 +00:00
if "cas_server" in settings.INSTALLED_APPS:
urlpatterns += [
# Include CAS Server routers
path('cas/', include('cas_server.urls', namespace="cas_server")),
]
2020-03-08 22:03:35 +00:00
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns
2020-04-25 17:29:18 +00:00
handler400 = bad_request
handler403 = permission_denied
# Only displayed in production, when debug mode is set to False
handler404 = page_not_found
handler500 = server_error