0

I am trying to set up django-toolbar in my production site, so just certain IPs can use it. I have followed the official documentation (install and quick setup), but I can't see the toolbar.

The app is installed:

$ yolk -l | grep toolbar
django-debug-toolbar - 0.11.0       - active

I have added the required settings:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.sitemaps',

    'modeltranslation',

    'djangocms_text_ckeditor',
    'cms',
    'mptt',
    'menus',
    'south',
    'sekizai',

    'debug_toolbar',
    # more stuff...
)

INTERNAL_IPS = ('---.---.---.---',) # my current ip, taken from the server logs so I'm sure it's correct

STATIC_URL = '/static/'

DEBUG = True

There's no error message. I have also run collectstatic just in case. No success.

Any suggestion? Thanks :-)

EDIT: it seems that the order within INSTALLED_APPS matters. Moving 'debug_toolbar' right after all 'django.contrib.*' and before 'modeltranslation' and the others solved the issue.

sogeking
  • 1,216
  • 2
  • 14
  • 45

2 Answers2

0

Have you set the INTERNAL_IPS to what is in request.META['REMOTE_ADDR'] (second answer here)?

I had a similar problem, the toolbar wasn't displaying and I couldn't figure out why. But when I printed request.META['REMOTE_ADDR'] my IP wasn't what I thought it was! (because I was using port forwarding and virtual box).

Community
  • 1
  • 1
Patrick
  • 189
  • 1
  • 6
  • I have put into INTERNAL_IPS the ip address shown at /var/log/httpd/access_log when I access my server, so I suppose it's the public one. You're right, I thought that my IP was another. But anyhow it doesn't work even after restarting apache. – sogeking Feb 18 '14 at 17:12
0

I found out the reason. Within INSTALLED_APPS, 'debug_toolbar' must appear as soon as possible. I had placed some other applications before ('modeltranslation', 'cms', etc.). Placing it just after all 'django.contrib.*' and before the others works fine.

sogeking
  • 1,216
  • 2
  • 14
  • 45