2024-02-07 02:26:49 +01:00
|
|
|
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
|
2019-07-08 11:08:07 +02:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2019-07-07 20:49:02 +00:00
|
|
|
|
2020-03-07 22:28:59 +01:00
|
|
|
from django.conf import settings
|
|
|
|
from django.conf.urls.static import static
|
2019-07-08 11:08:07 +02:00
|
|
|
from django.urls import path, include
|
2020-04-25 19:29:18 +02:00
|
|
|
from django.views.defaults import bad_request, permission_denied, page_not_found, server_error
|
2020-03-19 16:12:52 +01:00
|
|
|
from member.views import CustomLoginView
|
|
|
|
|
2020-07-29 11:38:59 +02:00
|
|
|
from .admin import admin_site
|
2020-10-07 11:29:52 +02:00
|
|
|
from .views import IndexView
|
2020-07-29 11:38:59 +02:00
|
|
|
|
2019-07-07 20:49:02 +00:00
|
|
|
urlpatterns = [
|
2019-07-17 13:34:07 +02:00
|
|
|
# Dev so redirect to something random
|
2020-10-07 11:29:52 +02:00
|
|
|
path('', IndexView.as_view(), name='index'),
|
2019-07-17 13:34:07 +02:00
|
|
|
|
|
|
|
# Include project routers
|
|
|
|
path('note/', include('note.urls')),
|
2020-03-01 17:16:38 +01:00
|
|
|
path('accounts/', include('member.urls')),
|
2020-04-05 05:17:28 +02:00
|
|
|
path('registration/', include('registration.urls')),
|
2020-03-01 17:16:38 +01:00
|
|
|
path('activity/', include('activity.urls')),
|
2020-03-21 00:30:49 +01:00
|
|
|
path('treasury/', include('treasury.urls')),
|
2020-04-11 03:37:06 +02:00
|
|
|
path('wei/', include('wei.urls')),
|
2024-05-21 11:21:13 +02:00
|
|
|
path('food/',include('food.urls')),
|
2019-07-08 11:08:07 +02:00
|
|
|
|
|
|
|
# Include Django Contrib and Core routers
|
|
|
|
path('i18n/', include('django.conf.urls.i18n')),
|
|
|
|
path('admin/doc/', include('django.contrib.admindocs.urls')),
|
2020-07-29 11:38:59 +02:00
|
|
|
path('admin/', admin_site.urls, name="admin"),
|
2020-03-19 16:12:52 +01:00
|
|
|
path('accounts/login/', CustomLoginView.as_view()),
|
|
|
|
path('accounts/', include('django.contrib.auth.urls')),
|
2020-02-06 23:29:17 +01:00
|
|
|
path('api/', include('api.urls')),
|
2020-04-26 01:20:46 +02:00
|
|
|
path('permission/', include('permission.urls')),
|
2019-07-07 20:49:02 +00:00
|
|
|
]
|
2020-03-03 14:24:07 +01:00
|
|
|
|
2021-10-04 13:58:48 +02:00
|
|
|
# During development, serve static and media files
|
2020-09-09 17:14:03 +02:00
|
|
|
if settings.DEBUG:
|
2021-10-04 13:58:48 +02:00
|
|
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
2020-09-09 17:14:03 +02:00
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
2020-03-08 23:03:35 +01:00
|
|
|
|
2020-09-21 12:15:40 +02:00
|
|
|
if "oauth2_provider" in settings.INSTALLED_APPS:
|
|
|
|
# OAuth2 provider
|
|
|
|
urlpatterns.append(
|
|
|
|
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider'))
|
|
|
|
)
|
2020-03-08 23:03:35 +01:00
|
|
|
|
2021-03-03 18:13:33 +01:00
|
|
|
if "cas_server" in settings.INSTALLED_APPS:
|
|
|
|
urlpatterns.append(
|
|
|
|
path('cas/', include('cas_server.urls', namespace='cas_server'))
|
|
|
|
)
|
|
|
|
|
2020-03-08 23:03:35 +01:00
|
|
|
if "debug_toolbar" in settings.INSTALLED_APPS:
|
|
|
|
import debug_toolbar
|
|
|
|
urlpatterns = [
|
|
|
|
path('__debug__/', include(debug_toolbar.urls)),
|
|
|
|
] + urlpatterns
|
2020-04-25 19:29:18 +02:00
|
|
|
|
2024-01-24 20:14:32 +01:00
|
|
|
if "django_htcpcp_tea" in settings.INSTALLED_APPS:
|
|
|
|
# Make coffee
|
|
|
|
urlpatterns.append(
|
|
|
|
path('coffee/', include('django_htcpcp_tea.urls'))
|
|
|
|
)
|
2020-04-25 19:29:18 +02: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
|