Skip to content

Commit

Permalink
Add Media urls and debug toolbar only when Debug=true
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Dec 20, 2024
1 parent e86f14c commit f2127e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions chords/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

import debug_toolbar
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
Expand All @@ -30,5 +29,12 @@
path("tenants/", include(("tenants.urls", "tenants"), namespace="tenants")),
re_path(r"^", include(("backend.urls", "backend"), namespace="chords")),
path("admin/", admin.site.urls),
path("__debug__/", include(debug_toolbar.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
]

if settings.DEBUG:
import debug_toolbar

urlpatterns += [
path("__debug__/", include(debug_toolbar.urls)),
*static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
]

0 comments on commit f2127e5

Please sign in to comment.