5

I am having issues trying to get the django-debug-toolbar up and running. I have all of the necessary info added to INSTALLED_APPS, MIDDLEWARE_CLASSES, and my ip is in the INTERNAL_IPS tuple. I have run the setup.py script and everything seems to load fine as I am getting no errors from django or apache.

However, nothing happens - no toolbar on any pages, has anyone else ever seen this behavior? Am I missing something obvious?

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
HurnsMobile
  • 4,341
  • 3
  • 27
  • 39

2 Answers2

8

I had this same issue for awhile.

Have you tried logging into the admin panel? If the toolbar displays there, but does not display in your code, it's very likely that you are missing the opening and closing tags in your template. By default, django debug toolbar attaches to the BODY tag, though you can change this behavior if you desire. See this question: Django Debug Toolbar Only Working for Admin Section

Community
  • 1
  • 1
Andrew Parker
  • 141
  • 1
  • 3
2

I'd either do one of 2 things:

insert import pdb; pdb.set_trace() at the middleware _show_toolbar method and see which item it fails on, or pepper the middleware with print statements to see which check it failed on, whichever you're more comfortable with.

def _show_toolbar(self, request, response=None):
        if not settings.DEBUG or not getattr(settings, 'DEBUG_TOOLBAR', True) or getattr(settings, 'TEST', False):
            return False

        if request.path.startswith(settings.MEDIA_URL):
            return False

        if response:
            if getattr(response, 'skip_debug_response', False):
                return False
            if response.status_code >= 300 and response.status_code < 400:
                return False

        # Allow access if remote ip is in INTERNAL_IPS or
        # the user doing the request is logged in as super user.
        if (not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 
           (not request.user.is_authenticated() or not request.user.is_superuser)):
            return False
        return True
Yuji 'Tomita' Tomita
  • 115,817
  • 29
  • 282
  • 245
  • `DEBUG` is True, im using apache not the dev server. To rule out any IP problems I am logging in as the admin now and still nothing. I'm not sure what you are trying to say with this code sample. – HurnsMobile Feb 17 '11 at 22:17
  • I was just suggesting placing log statements in the middleware to determine which test is failing to help narrow down the cause. – Yuji 'Tomita' Tomita Feb 17 '11 at 22:25
  • I don't understand how this answer actually answers the question. It's a way of debugging, but what if you don't even get to this part? What was the actual configuration error? [I have a problem with the exact same symptoms] – Jon Watte Jun 17 '11 at 18:46