Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'djdt' is not a registered namespace #911

Closed
NomadDemon opened this issue Jan 28, 2017 · 9 comments
Closed

'djdt' is not a registered namespace #911

NomadDemon opened this issue Jan 28, 2017 · 9 comments

Comments

@NomadDemon
Copy link

Hi, its my 3 try of debugtoolbar and.. 3 times fail

First if couldnt get it shown.
2 years later same,
this time i get errors :

NoReverseMatch at /
'djdt' is not a registered namespace

I did everything in settings and URLS as i should

problem is in line 14:

13 <div id="djDebug" class="djdt-hidden" dir="ltr"
14 	     data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"
15 	     {{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }}>

django version 1.9 1.10, 1.10.04
debug panel 1.6 from PIP3

settings:

INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_hosts',
'ckeditor',
'django_user_agents',
'debug_toolbar',
'apps.core',
'apps.blog']

INTERNAL_IPS
('127.0.0.1', '192.168.1.41')

MIDDLEWARE_CLASSES
('django_hosts.middleware.HostsRequestMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django_hosts.middleware.HostsResponseMiddleware',
'django_user_agents.middleware.UserAgentMiddleware')

DEBUG is set to TRUE

Please.. help.. its frustrating i cannot use one of best tools for debuging for 3 years...

@aaugustin
Copy link
Contributor

Most likely this error means you didn't configure the URLs correctly.

@NomadDemon
Copy link
Author

NomadDemon commented Jan 28, 2017

_CFG.DEBUG = True


if _CFG.DEBUG:
	import debug_toolbar
	urlpatterns += [
		url(r'^__debug__/', include(debug_toolbar.urls)),
		url(r'^site_media/(?P<path>.*)$', 	serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
		url(r'^static/(?P<path>.*)$', 		serve, {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
	]

@NomadDemon
Copy link
Author

Help.. please? :(

@matthiask
Copy link
Member

Looks good (I think). Maybe you could try showing us the whole URLconf file? Does /site_media/ work locally? What is _CFG? Is the code you posted part of your ROOT_URLCONF, or are you maybe already inside another namespace?

@NomadDemon
Copy link
Author

yes, it was part of root urls

from django.conf.urls.i18n import i18n_patterns
from django.conf.urls import url, include
from django.conf import settings
from django.contrib import admin
from django.views.decorators.cache import cache_page
from django.views.generic.base import RedirectView
from django.views.generic import *
from django.views.static import serve
from django.views.i18n import javascript_catalog
from django.utils.translation import ugettext_lazy as _

from ..core.views import *

import config as _CFG

admin.autodiscover()

urlpatterns = [
	url(r'^jsi18n/$', javascript_catalog),
	url(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog),
	url(r'^i18n/', include('django.conf.urls.i18n')),
	url(r'^admin/', include(admin.site.urls)),
	url(r'^ckeditor/', include('ckeditor_uploader.urls')),
]

urlpatterns += [
	url(r'^lang/(?P<lang>[\w\-]+)$', 	set_lang),
	url(r'^error-(?P<ID>\d+)$',	 errors),

	url(r'^login/$', 	login),
	url(r'^logout/$', 	logout),

	url(r'^favicon\.ico$', 	RedirectView.as_view(permanent=True, url='static/favicon.ico')),
	url(r'^favicon\.png$', 	RedirectView.as_view(permanent=True, url='static/favicon.png')),
	url(r'^prev\.png$', 	RedirectView.as_view(permanent=True, url='static/icons/prev.png')),
	url(r'^robots\.txt$',  	RedirectView.as_view(permanent=True, url='static/robots.txt')),
	url(r'^sitemap\.xml$',  RedirectView.as_view(permanent=True, url='static/sitemap.xml')),
]

if _CFG.REGISTRABLE:
	urlpatterns += [
		url(r'^register/$',	views.register),
		url(r'^activate', views.activate),
	]

if _CFG.RESETABLE:
	urlpatterns += [
		url(r'^resetpass/$',	views.reset_password, {'typ' : 'resetpass'}),
		url(r'^resetpass2/$',	views.reset_password, {'typ' : 'resetpass2'}),
	]

if _CFG.DEBUG:
	import debug_toolbar
	urlpatterns += [
		url(r'^__debug__/', include(debug_toolbar.urls)),
		url(r'^site_media/(?P<path>.*)$', 	serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
		url(r'^static/(?P<path>.*)$', 		serve, {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
	]

handler404 = my404
handler500 = my404

if len(_CFG.APP_LIST) == 0:
	exec(open('./apps/www/urls.py').read())

cfg is just additional config file i use in project. It contains only constant values

@h4k1m0u
Copy link

h4k1m0u commented Mar 25, 2017

@NomadDemon Any progress with this issue?

@NomadDemon
Copy link
Author

Yes i figgured it out.
First i had some issues with configs, always prod config was used with DEBUG = False. - fixed

Then was problem with no toolbar visible.
When using gunicorn with SOCK option instead of HTTP, no remote_addr is passing. Had to manually used my own "validator for debugging user"

The 2nd part might be useful for other users.

@h4k1m0u
Copy link

h4k1m0u commented Mar 25, 2017 via email

@matthiask
Copy link
Member

Thanks. I think this issue can be closed then. Good to hear debug toolbar works for both of you now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants