Skip to content

django.urls.exceptions.NoReverseMatch: 'djdt' is not a registered namespace #1332

@lemaadi

Description

@lemaadi

Hi there,

I'm trying to configure django-debug-toolbar. As of now i did the following :

settings.py

DEBUG=True
if DEBUG:
INSTALLED_APPS += [ "debug_toolbar", ]

MIDDLEWARE += [
    "debug_toolbar.middleware.DebugToolbarMiddleware",
]

INTERNAL_IPS = [
    "127.0.0.1",
]

DEBUG_TOOLBAR_PANELS = [
    "debug_toolbar.panels.versions.VersionsPanel",
    "debug_toolbar.panels.timer.TimerPanel",
    "debug_toolbar.panels.settings.SettingsPanel",
    "debug_toolbar.panels.headers.HeadersPanel",
    "debug_toolbar.panels.request.RequestPanel",
    "debug_toolbar.panels.sql.SQLPanel",
    "debug_toolbar.panels.staticfiles.StaticFilesPanel",
    "debug_toolbar.panels.templates.TemplatesPanel",
    "debug_toolbar.panels.cache.CachePanel",
    "debug_toolbar.panels.signals.SignalsPanel",
    "debug_toolbar.panels.logging.LoggingPanel",
    "debug_toolbar.panels.redirects.RedirectsPanel",
    "debug_toolbar.panels.profiling.ProfilingPanel",
]

DEBUG_TOOLBAR_CONFIG = {
    "SHOW_TOOLBAR_CALLBACK": lambda request: DEBUG,
    "RESULTS_CACHE_SIZE": 3,
    "SHOW_COLLAPSED": True,
    "SQL_WARNING_THRESHOLD": 100,
}

urls.py

if settings.DEBUG:

import debug_toolbar

urlpatterns = [path("__debug__/", include(debug_toolbar.urls)),] + urlpatterns

The toolbar is working correctly, but when i run pytest tests/ or docker-compose run --rm app pytest tests/ i get this error :

django.urls.exceptions.NoReverseMatch: 'djdt' is not a registered namespace for some tests suite.

So, what did i missed ??
Thank's in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions