I fixed it by following this
http://django-debug-toolbar.readthedocs.org/en/1.2.2/installation.html
In my case, I had the wrong name in INSTALLED_APPS and I lacked this piece
of code in urls:
if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)
If anything similar happens to you, pay attention to the most little detail
in the instructions.
On Friday, 23 May 2014 12:06:19 UTC+2, Florian Auer wrote:
>
> Hi
>
> I am running 2 django 1.6.4 projects, both with debug toolbar enabled.
>
> The first one ist a simple project, following the a cookbook tutorial and
> the toolbar works fine inside.
> The second project ist the one, I'll wnated to start the real development
> in.
>
> But there every call to the most panels give me a 500 error:
> Internal Server Error: /__debug__/render_panel/
> Traceback (most recent call last):
> File "C:\Python33\lib\site-packages\django\core\handlers\base.py", line
> 114, in get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
> File "C:\Python33\lib\site-packages\debug_toolbar\views.py", line 19, in
> render_panel
> content = panel.content
> File "C:\Python33\lib\site-packages\debug_toolbar\panels\__init__.py",
> line 87, in content
> return render_to_string(self.template, self.get_stats())
> File "C:\Python33\lib\site-packages\django\template\loader.py", line
> 162, in render_to_string
> t = get_template(template_name)
> File "C:\Python33\lib\site-packages\django\template\loader.py", line
> 138, in get_template
> template, origin = find_template(template_name)
> File "C:\Python33\lib\site-packages\django\template\loader.py", line
> 127, in find_template
> source, display_name = loader(name, dirs)
> File "C:\Python33\lib\site-packages\django\template\loader.py", line 43,
> in __call__
> return self.load_template(template_name, template_dirs)
> File "C:\Python33\lib\site-packages\django\template\loader.py", line 49,
> in load_template
> template = get_template_from_string(source, origin, template_name)
> File "C:\Python33\lib\site-packages\django\template\loader.py", line
> 149, in get_template_from_string
> return Template(source, origin, name)
> File
> "C:\Python33\lib\site-packages\debug_toolbar\panels\templates\panel.py",
> line 71, in new_template_init
> old_template_init(self, template_string, origin, name)
> File "C:\Python33\lib\site-packages\django\template\base.py", line 125,
> in __init__
> self.nodelist = compile_string(template_string, origin)
> File "C:\Python33\lib\site-packages\django\template\base.py", line 153,
> in compile_string
> return parser.parse()
> File "C:\Python33\lib\site-packages\django\template\base.py", line 278,
> in parse
> compiled_result = compile_func(self, token)
> File "C:\Python33\lib\site-packages\django\template\defaulttags.py",
> line 806, in do_for
> nodelist_loop = parser.parse(('empty', 'endfor',))
> File "C:\Python33\lib\site-packages\django\template\base.py", line 278,
> in parse
> compiled_result = compile_func(self, token)
> File "C:\Python33\lib\site-packages\django\template\defaulttags.py",
> line 573, in cycle
> PendingDeprecationWarning, stacklevel=2)
> PendingDeprecationWarning: 'The `cycle` template tag is changing to escape
> its arguments; the non-autoescaping version is deprecated. Load it from the
> `future` tag library to start using the new behavior.
> [23/May/2014 11:59:50] "GET
> /__debug__/render_panel/?store_id=e6eeea46ebc04510bf489db8336adf0f&panel_id=SettingsPanel
>
> HTTP/1.1" 500 14196
>
> the main difference is with this project, that it has a template
> dependency, using a mysql connector instead of sqlite.
> From my point of view I dont knwo whats the problem.
>
> settings.py:
> # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
> SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
> DEBUG = True
> TEMPLATE_DEBUG = True
> ALLOWED_HOSTS = ['127.0.0.1']
> # Application definition
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'cockpit',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
> #START addition for DEBUG-TOOLBAR
> INSTALLED_APPS += (
> 'debug_toolbar',
> )
> MIDDLEWARE_CLASSES += (
> 'debug_toolbar.middleware.DebugToolbarMiddleware',
> )
> INTERNAL_IPS = ('127.0.0.1',)
> #DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False} #deprecated
> #END addition for DEBUG-TOOLBAR
>
> #START addition or userauth app
> INSTALLED_APPS += (
> 'userauth',
> )
>
> #START Mobile Detection -> based on mobileESP
> MIDDLEWARE_CLASSES += (
> 'mobileesp.middleware.MobileDetectionMiddleware',
> )
> #END Mobile Detection
>
> ROOT_URLCONF = 'myProjectName.urls'
> WSGI_APPLICATION = 'myProjectName.wsgi.application'
>
>
> # Database
> # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'mysql.connector.django',
> 'NAME': 'myProjectName',
> 'USER': 'root',
> 'PASSWORD': 'xxxxx',
> 'HOST': '127.0.0.1',
> 'PORT': '3306'
> }
> }
>
> # Internationalization
> # https://docs.djangoproject.com/en/1.6/topics/i18n/
>
> LANGUAGE_CODE = 'de'
>
> TIME_ZONE = 'Europe/Berlin'
>
> USE_I18N = True
>
> USE_L10N = True
>
> USE_TZ = True
>
>
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/1.6/howto/static-files/
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> os.path.join(BASE_DIR, "static"),
> #'/var/www/static/', #not jet used
> )
>
> TEMPLATE_DIRS = (
> os.path.join(BASE_DIR, 'templates'),
> os.path.join(BASE_DIR, 'templates/desktop'),
> os.path.join(BASE_DIR, 'templates/tablet'),
> os.path.join(BASE_DIR, 'templates/mobile'),
> )
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'filters': {
> 'require_debug_false': {
> '()': 'django.utils.log.RequireDebugFalse'
> }
> },
> 'formatters': {
> 'simple': {
> 'format': '%(levelname)s %(asctime)s %(pathname)s %(message)s'
> }
> },
> 'handlers': {
> 'mail_admins': {
> 'level': 'ERROR',
> 'filters': ['require_debug_false'],
> 'class': 'django.utils.log.AdminEmailHandler'
> },
> 'debuglog': {
> 'level': 'DEBUG',
> 'class': 'logging.handlers.RotatingFileHandler',
> 'filename': os.path.join(BASE_DIR, '..', 'debug.log'),
> 'maxBytes': 50000,
> 'backupCount': 1,
> 'formatter': 'simple'
> }
> },
> 'loggers': {
> 'django.request': {
> 'handlers': ['mail_admins'],
> 'level': 'ERROR',
> 'propagate': True,
> },
> }
> }
> if DEBUG:
> LOGGING['loggers'].update(
> {'cockpit': {
> 'handlers': ['debuglog'],
> 'level': 'DEBUG'
> },
> 'userauth': {
> 'handlers': ['debuglog'],
> 'level': 'DEBUG'
> }}
> )
>
> Any help is welcome
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/b7c6e4d3-321c-40ea-b73f-02a43f785abb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.