mirror of
https://github.com/bugsink/bugsink.git
synced 2026-02-19 21:09:26 -06:00
Django Debug Toolbar: don't crash when not installed
It happens with some regularity that people notice the "DEBUG" setting and try to run with DEBUG=True. Although this is not documented nor recommended you can't really blame 'm, and it would probably help them debug their issues. Pre-this-commit that was not possible, because the debug toolbar is usually not installed (and on e.g. on Docker this is very annoying to do).
This commit is contained in:
@@ -63,9 +63,16 @@ if settings.DEBUG:
|
|||||||
path('debug-users-email/<str:template_name>/', debug_users_email),
|
path('debug-users-email/<str:template_name>/', debug_users_email),
|
||||||
path('debug-teams-email/<str:template_name>/', debug_teams_email),
|
path('debug-teams-email/<str:template_name>/', debug_teams_email),
|
||||||
path('trigger-error/', trigger_error),
|
path('trigger-error/', trigger_error),
|
||||||
path("__debug__/", include("debug_toolbar.urls")),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
try:
|
||||||
|
import debug_toolbar # noqa
|
||||||
|
urlpatterns = [
|
||||||
|
path('__debug__/', include('debug_toolbar.urls')),
|
||||||
|
] + urlpatterns
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
handler400 = "bugsink.views.bad_request"
|
handler400 = "bugsink.views.bad_request"
|
||||||
handler403 = "bugsink.views.permission_denied"
|
handler403 = "bugsink.views.permission_denied"
|
||||||
|
|||||||
Reference in New Issue
Block a user