Closed
Description
I don't want to have the django-debug-toolbar
package installed in my production environment, so I'm looking for alternatives to a slightly "dirty" import which is not at the top of the file (see PEP-402):
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns.append(url(r"^__debug__/", include(debug_toolbar.urls)))
But the obvious string-module-path
urlpatterns.append(url(r"^__debug__/", include("debug_toolbar.urls")))
fails due to the error ModuleNotFoundError: No module named 'debug_toolbar.urls'
.
However, I noticed that
urlpatterns.append(url(r"^__debug__/", include("debug_toolbar.toolbar")))
seems to work, so I wonder why this isn't documented. Are there any downsides to this approach, or might this stop to work in future versions of the django debug toolbar?
Thanks for any comments on this!
Django version: 3.2.7
Django Debug Toolbar version: 3.2.2
Metadata
Metadata
Assignees
Labels
No labels