Closed jeyraof closed 6 years ago
Can I get some insight to resolve it, @jezdez ?
Usage questions aren't answered on the issue tracker.
It seems I had to include the toolbar into every application to avoid the 'djdt' is not a registered namespace problem. My solution is a generic file that I drop to each site next to urls.py:
# urls_debug.py
from django.urls import path, include
import debug_toolbar
from .urls import urlpatterns as original_urlpatterns
urlpatterns = original_urlpatterns + [
path('__debug__/', include(debug_toolbar.urls)),
]
And in hosts I include it this way:
# hosts.py
from django_hosts import patterns, host
from django.conf import settings
def enable_debug(path: str) -> str:
if settings.DEBUG:
path += "_debug"
return path
host_patterns = patterns(
"",
host(r"www", enable_debug("www.urls"), name="www"),
host(r"dash", enable_debug("dash.urls"), name="dash"),
host(r"admin", enable_debug("adm.urls"), name="admin"),
)
In
hosts.py
:And now, I'm using debug_toolbar on every app like:
app_one/urls.py
:app_two/urls.py
:So, how to insert debug_toolbar urls to every urls mentioned by hosts.py ?