Skip to content

Commit 900d427

Browse files
JacobCoffeeclaude
andcommitted
fix: guard debug_toolbar import in urls.py
The DEBUG flag is True by default in base settings, but debug_toolbar may not be installed (e.g. in CI). Guard the import to prevent ModuleNotFoundError when running without dev extras. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1b9afc1 commit 900d427

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pydotorg/urls.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373

7474
if settings.DEBUG:
7575
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
76-
import debug_toolbar
76+
try:
77+
import debug_toolbar
7778

78-
urlpatterns = [path("__debug__/", include(debug_toolbar.urls)), *urlpatterns]
79+
urlpatterns = [path("__debug__/", include(debug_toolbar.urls)), *urlpatterns]
80+
except ImportError:
81+
pass

0 commit comments

Comments
 (0)