-
Website
http://rob.cogit8.org/ -
Original page
http://rob.cogit8.org/blog/2008/Sep/19/introducing-django-debug-toolbar/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
arthurk
1 comment · 1 points
-
Rob Hudson
23 comments · 3 points
-
davedash
1 comment · 3 points
-
xktybot
1 comment · 1 points
-
sro
1 comment · 1 points
-
-
Popular Threads
Again, congrats for your work, this is a fantastic debugging tool.
import simplejson
to:
from django.utils import simplejson
in: views.py, panels/sql.py
Which would be cool.
encoding.smart_unicode(response.content)
in middleware.py", line 69 solves my problems :)
In other news, I think DebugToolbarMiddleware's process_request modifies the urls every time there's no match, which ends up multiplying the existing urls. This is easily replicated with an empty project.
I've narrowed it down to this bit of the template panel template:
<dd>
<div class="djTemplateShowContextDiv">Toggle Context</div>
<div class="djTemplateHideContextDiv" style="display:none;"><pre>{{ template.context }}</pre></div>
</dd>
If I comment that out, it works fine (albeit without showing the context, which is one of the most useful bits!).
I have seen the SQL panel cause hangs, too, but this only seems to happen on pages with excessive queries (my fault, not yours, but it would be nice if it handled the situation a bit more gracefully).
Sidenote: If DEBUG=False, the debug toolbar throws loud, fatal type errors. I would assert that it should fail silently, and just do nothing (so that the page gets rendered as per usual, sans toolbar).
Again, great work! Despite a few looking issues, this is really, really great stuff. Thanks to everyone involved!
{% for template in template_dirs %}
<li>{{ template }}</li>
{% endfor %}
to:
{% for template in template_dirs %}
<li>{{ template|addslashes }}</li>
{% endfor %}
i.e. adding '|addslashes' to the 'template' variable.
But it's nice you do it for django! :)
Is there any solution to that problem?
this is amazing stuff.
No error messages, nothing.... any ideas?
I was hoping to report (what appears to be) a bug. Let me know if there's anywhere to do that...
odio (dot) sam (a t) gmail (dot) com
thank you so much!
@import url(/__debug__/m/toolbar.min.css);
and
<script type="text/javascript" src="/__debug__/m/toolbar.min.js"></script>
If I'm being dense forgive me. Any help would be greatly appreciated.
settings.py
================================
import re
DEBUG_IPS = (
re.compile(r'^192.168.1.*'),
)
================================
Then in the middleware.py I changed the show_toolbar method:
================================
def show_toolbar(self, request):
if not settings.DEBUG:
return False
if request.is_ajax():
return False
for user_agent_regex in settings.DEBUG_IPS:
if user_agent_regex.search(request.META['REMOTE_ADDR']):
return True
if not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:
return False
return True
================================
Thanks!
2. Got all installed and have simple django app going but don't see the toolbar??
Using local test server.
INTERNAL_IPS = INTERNAL_IPS = ('127.0.0.1',)
& rest of settings as per setup
Any pointers would be appreciated as I am keen to have a look.
Many Thanks
I saw it was working fine in django admin but not in my app.
After adding <html><header><body> tags it was ok,
Thanks
Great piece of software. I just installed it today, and I'm trying to understand a problem. The number of SQL queries I see in the toolbar always appears to be less than the number being reported in the debug context (available in "templates/django.core.context_processors.debug". Two reasons that I can think of: 1) where you introduce the middleware matters---that is if comes after the session and authentication middleware, then the sql requests for those are not included, and 2) the debug panel triggers some queries of some sort? Number one appears to be true for certain; I moved the middleware insertion point around to see the effect, but it doesn't explain ALL of the differences. Can you clue me in if something else is going on?
One place that differs between the toolbar's way of getting queries and the context processor is if you call the context processor and iterate over its results in a template that continues to do template calls further down the template, you may miss some queries getting called since the context processor gathers up its queries at the time it's called. Versus the toolbar that gathers up its queries via the process_response hook in the middleware. But what I'm describing usually leads to more queries appearing in the toolbar, not less.
One area that may trigger extra queries is if the template context contains objects whose __str__ or __unicode__ methods execute queries. Since the toolbar is attempting to print the objects in the template context, this would trigger extra queries if those methods execute queries.
As to the other--middleware placement--it does appear to make a difference. If I include the toolbar just before or right after the session/authentication middleware, the session/authentication queries show up in the tool bar, but not if I put it further down the list.
Again, thanks for this. It has been a great help so far.
Second, I'm having a little trouble getting the cache watcher to work in development. I run memcached in production, and a database table based system in development. When I check the table in the DB I see that pages are caching, but I'm not seeing any results in the toolbar. Ideas on what I'm screwing up?
Thanks in advance everybody.
I did modify the CSS a bit so that the bar aligns to the bottom instead of the top.
No issues until now, let me congratulate you and the rest for this great app. Thank you!