2016-11-06 15:39:14 +01:00
|
|
|
"""
|
|
|
|
Fichier principal de configuration des urls du projet GestioCOF
|
|
|
|
"""
|
2016-07-09 19:49:38 +02:00
|
|
|
from django.conf import settings
|
2018-02-03 22:34:37 +01:00
|
|
|
from django.conf.urls.i18n import i18n_patterns
|
2016-07-09 19:49:38 +02:00
|
|
|
from django.conf.urls.static import static
|
2016-05-21 23:57:36 +02:00
|
|
|
from django.contrib import admin
|
2019-04-12 17:05:18 +02:00
|
|
|
from django.urls import include, path
|
2016-07-18 18:46:48 +02:00
|
|
|
|
2020-08-11 17:19:32 +02:00
|
|
|
# Website administration (independent from installed apps)
|
2016-07-09 21:19:37 +02:00
|
|
|
admin.autodiscover()
|
2016-11-06 01:36:10 +01:00
|
|
|
urlpatterns = [
|
2019-04-12 17:05:18 +02:00
|
|
|
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
|
|
|
path("admin/", admin.site.urls),
|
2016-09-12 22:08:39 +02:00
|
|
|
]
|
|
|
|
|
2020-05-09 16:21:40 +02:00
|
|
|
if "gestioncof" in settings.INSTALLED_APPS:
|
2020-07-04 13:30:54 +02:00
|
|
|
from django_js_reverse.views import urls_js
|
|
|
|
from wagtail.admin import urls as wagtailadmin_urls
|
|
|
|
from wagtail.documents import urls as wagtaildocs_urls
|
|
|
|
|
2020-05-09 16:21:40 +02:00
|
|
|
|
|
|
|
# Also includes BdA, K-Fêt, etc.
|
|
|
|
urlpatterns += [
|
|
|
|
path("admin/logout/", gestioncof_views.logout),
|
|
|
|
path(
|
|
|
|
"admin/<slug:app_label>/<slug:model_name>/csv/",
|
|
|
|
csv_views.admin_list_export,
|
|
|
|
{"fields": ["username"]},
|
|
|
|
),
|
|
|
|
# Page d'accueil
|
|
|
|
path("", gestioncof_views.HomeView.as_view(), name="home"),
|
|
|
|
# Le BdA
|
|
|
|
path("bda/", include("bda.urls")),
|
|
|
|
# Les petits cours
|
|
|
|
path("petitcours/", include("petitscours.urls")),
|
|
|
|
path("k-fet/", include("kfet.urls")),
|
|
|
|
path("cms/", include(wagtailadmin_urls)),
|
|
|
|
path("documents/", include(wagtaildocs_urls)),
|
|
|
|
# js-reverse
|
|
|
|
path("jsreverse/", urls_js, name="js_reverse"),
|
|
|
|
]
|
|
|
|
|
|
|
|
if "bds" in settings.INSTALLED_APPS:
|
|
|
|
urlpatterns.append(path("bds/", include("bds.urls")))
|
|
|
|
|
2019-10-05 15:58:11 +02:00
|
|
|
if "events" in settings.INSTALLED_APPS:
|
|
|
|
# The new event application is still in development
|
|
|
|
# → for now it is namespaced below events_v2
|
2020-05-09 16:21:40 +02:00
|
|
|
# → rename this when the old events system is out
|
2019-10-05 15:58:11 +02:00
|
|
|
urlpatterns += [path("event_v2/", include("events.urls"))]
|
|
|
|
|
2020-07-30 12:04:04 +02:00
|
|
|
if "authens" in settings.INSTALLED_APPS:
|
|
|
|
urlpatterns.append(path("authens/", include("authens.urls")))
|
|
|
|
|
2018-10-06 12:35:49 +02:00
|
|
|
if "debug_toolbar" in settings.INSTALLED_APPS:
|
2016-11-06 15:39:14 +01:00
|
|
|
import debug_toolbar
|
2018-10-06 12:35:49 +02:00
|
|
|
|
2019-04-12 17:05:18 +02:00
|
|
|
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
|
2016-11-06 15:39:14 +01:00
|
|
|
|
2017-05-30 20:44:30 +02:00
|
|
|
if settings.DEBUG:
|
2016-11-06 01:36:10 +01:00
|
|
|
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
|
|
|
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
2018-10-06 12:35:49 +02:00
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
2017-05-30 20:44:30 +02:00
|
|
|
|
|
|
|
# Wagtail for uncatched
|
2020-05-09 16:21:40 +02:00
|
|
|
if "wagtail.core" in settings.INSTALLED_APPS:
|
|
|
|
from wagtail.core import urls as wagtail_urls
|
|
|
|
|
|
|
|
urlpatterns += i18n_patterns(
|
|
|
|
path("", include(wagtail_urls)), prefix_default_language=False
|
|
|
|
)
|