40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
# This file is part of photo21
|
|
# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
"""photo21 URL Configuration
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
https://docs.djangoproject.com/en/2.2/topics/http/urls/
|
|
"""
|
|
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
from django.contrib import admin
|
|
from django.urls import include, path, re_path
|
|
from django.views.i18n import JavaScriptCatalog
|
|
|
|
if settings.DEBUG:
|
|
from debug_toolbar.toolbar import debug_toolbar_urls
|
|
|
|
from .views import IndexView, MediaAccess
|
|
|
|
urlpatterns = [
|
|
path("select2/", include("django_select2.urls")),
|
|
path("", IndexView.as_view(), name="index"),
|
|
path("", include("photologue.urls", namespace="photologue")),
|
|
path("accounts/", include("allauth.urls")),
|
|
path("i18n/", include("django.conf.urls.i18n")),
|
|
path("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
|
|
path("admin/doc/", include("django.contrib.admindocs.urls")),
|
|
path("admin/", admin.site.urls),
|
|
]
|
|
|
|
# In production media are served through NGINX with X-Accel-Redirect
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
urlpatterns += debug_toolbar_urls()
|
|
else:
|
|
urlpatterns.append(
|
|
re_path("^media/(?P<path>.*)", MediaAccess.as_view(), name="media")
|
|
)
|