Three followups on 7075269: - config/urls.py: drop dead try/except ImportError fallback. The settings.py gate already guarantees debug_toolbar is importable before we reach this line, so the except branch was unreachable and the re-import of include/path was redundant (both imported at top of file). - config/settings.py: SHOW_TOOLBAR_CALLBACK now returns True unconditionally. The triple gate passed at settings-load time, so re-checking DEBUG and _IS_DEV inside the lambda was redundant. Comment corrected — the callback has nothing to do with "stale cached pages". - requirements.txt: inline comment noting django-debug-toolbar is dev-only and gated. No behavioural change. Tests: 68/68. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
from django.contrib import admin
|
|
from django.urls import include, path
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
|
|
urlpatterns = [
|
|
path("admin/", admin.site.urls),
|
|
path("accounts/", include("django.contrib.auth.urls")),
|
|
path("", include("core.urls")),
|
|
]
|
|
|
|
if settings.DEBUG:
|
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
# === DEV-ONLY: Django Debug Toolbar URL include ===
|
|
# Matches the conditional load in settings.py. No-op in prod.
|
|
# The settings.py gate already guarantees debug_toolbar is importable
|
|
# by the time we get here, so no try/except is needed. If we ever
|
|
# downgrade to a toolbar version older than v4.0 (which introduced
|
|
# debug_toolbar_urls), swap this for `path('__debug__/', include(debug_toolbar.urls))`.
|
|
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
|
from debug_toolbar.toolbar import debug_toolbar_urls
|
|
urlpatterns += debug_toolbar_urls() |