annuaire/urls: Ajout de djdt en mode debug

This commit is contained in:
Tom Hubrecht 2023-01-30 21:23:52 +01:00
parent f6e2f8404d
commit b0226afa1e

View file

@ -14,10 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from fiches.views import BirthdayView, HomeView
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("", include("fiches.urls")),
@ -26,5 +25,9 @@ urlpatterns = [
path("i18n/", include("django.conf.urls.i18n")),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG and "debug_toolbar" in settings.INSTALLED_APPS:
from debug_toolbar import urls as debug_urls
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + [
path("__debug__/", include(debug_urls))
]