[Django] Debug Toolbar

6 Серпня 2009

Django Debug Toolbar very nice thing, but it has some limits the functionality. One of them is lack of EXLUDE_URL. But I fix it. And now you can add to config next thing:

DEBUG_TOOLBAR_CONFIG = { 'EXCLUDE_URLS': (r'/admin.*',), }

After this you must download this component from my github project - http://github.com/presidentua/gread/.

Yet I added in file debug_tollbar/middleware.py only some lines:

def _show_toolbar(self, request): if not settings.DEBUG: return False if request.is_ajax() and not \ request.path.startswith(os.path.join('/', debug_toolbar.urls._PREFIX)): # Allow ajax requests from the debug toolbar return False if not request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: return False #next lines I added if hasattr(settings, 'DEBUG_TOOLBAR_CONFIG'): exlude_urls = settings.DEBUG_TOOLBAR_CONFIG.get( 'EXCLUDE_URLS', None) for url in exlude_urls: if re.match(url,request.path): return False return True

If U don't use django_toolbar, try. I think, U will like it ;)

 
 
 
Роман Хоменко aka PresidentUA
mail/jabber: spirt40@gmail.com