zaphod
zaphod

Reputation: 2095

Cannot get django-debug-toolbar to work

I have been incorporating advice from various threads on debug-toolbar here, but somehow cannot get it working. Would appreciate some help please.

  1. I am not developing locally. The server hosting the code is a WebFaction server and I am testing it from a browser on my local machine. debug-toolbar is installed on the server and I can see it in the server's PYTHONPATH.

  2. IP address used is the tuple of (request.HTTP_X_FORWARDED_FOR, request.REMOTE_ADDR)

  3. When I use these same debug-toolbar settings in a fresh Django test project on my local machine, it works.

  4. One post mentioned that using show_toolbar and returning True voided all the IP address checks. I have tried that too (below) to no avail.

  5. (Edit) This works from shell. I can run python manage debugsqlshell

settings.py:

DEBUG = True

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
)


INSTALLED_APPS = (
    ....
    'debug_toolbar',   # last in list
)

# Debug toolbar settings
INTERNAL_IPS = ('x.x.x.x', 'y.y.y.y') 
# This is IP address from request.HTTP_X_FORWARDED_FOR and request.REMOTE_ADDR that I see when I put an assert 0 in the code.
# When I got desperate, I also tried adding'127.0.0.1', '10.0.2.2' to no avail


DEBUG_TOOLBAR_PANELS = (
    'debug_toolbar.panels.version.VersionDebugPanel',
    'debug_toolbar.panels.timer.TimerDebugPanel',
    'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
    'debug_toolbar.panels.headers.HeaderDebugPanel',
    'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
    'debug_toolbar.panels.template.TemplateDebugPanel',
    'debug_toolbar.panels.sql.SQLDebugPanel',
    'debug_toolbar.panels.signals.SignalDebugPanel',
    'debug_toolbar.panels.logger.LoggingPanel',
)

# One post mentioned that using show_toolbar and returning True voided all the IP address checks. Trying it
def show_toolbar(request):
    return True

DEBUG_TOOLBAR_CONFIG = {
    'INTERCEPT_REDIRECTS': False,
    'SHOW_TOOLBAR_CALLBACK': show_toolbar,
    'HIDE_DJANGO_SQL': False,
    'TAG': 'div',
}

page.html: ...

<body id="try">
    <meta http-equiv="content-type" content="text/html"; charset="UTF-8">
    ...stuff...
</body>

Now, what am I not seeing here?

Upvotes: 1

Views: 929

Answers (1)

webzy
webzy

Reputation: 249

Shouldn't your: <meta http-equiv="content-type" content="text/html"; charset="UTF-8"> be this instead? <meta http-equiv="Content-Type" content="text/html; charset=utf8" />

Upvotes: 1

Related Questions