diff --git a/docs/installation.rst b/docs/installation.rst index b3ebbf76a..a1272b1d0 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -43,16 +43,16 @@ If you're upgrading from a previous version, you should review the Setting up URLconf ------------------ -Add the Debug Toolbar's URLs to your project's URLconf as follows:: +Add the Debug Toolbar's URLs to your project's URLconf:: + import debug_toolbar from django.conf import settings from django.urls import include, path - if settings.DEBUG: - import debug_toolbar - urlpatterns = [ - path('__debug__/', include(debug_toolbar.urls)), - ] + urlpatterns + urlpatterns = [ + ... + path('__debug__/', include(debug_toolbar.urls)), + ] This example uses the ``__debug__`` prefix, but you can use any prefix that doesn't clash with your application's URLs. Note the lack of quotes around diff --git a/example/urls.py b/example/urls.py index e263c3068..a190deaaa 100644 --- a/example/urls.py +++ b/example/urls.py @@ -1,17 +1,14 @@ -from django.conf import settings from django.contrib import admin from django.urls import include, path from django.views.generic import TemplateView +import debug_toolbar + urlpatterns = [ path("", TemplateView.as_view(template_name="index.html")), path("jquery/", TemplateView.as_view(template_name="jquery/index.html")), path("mootools/", TemplateView.as_view(template_name="mootools/index.html")), path("prototype/", TemplateView.as_view(template_name="prototype/index.html")), path("admin/", admin.site.urls), + path("__debug__/", include(debug_toolbar.urls)), ] - -if settings.DEBUG: - import debug_toolbar - - urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]