Skip to content

Commit 384d144

Browse files
committed
only load the toolbar if DEBUG, TEST, or INTERNAL_IPS match
1 parent 5c6dbbc commit 384d144

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

debug_toolbar/middleware.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ def _show_toolbar(self, request):
6262
remote_addr = x_forwarded_for.split(',')[0].strip()
6363
else:
6464
remote_addr = request.META.get('REMOTE_ADDR', None)
65-
if not remote_addr in settings.INTERNAL_IPS \
66-
or (request.is_ajax() and \
67-
not debug_toolbar.urls._PREFIX in request.path) \
68-
or not (settings.DEBUG and not getattr(settings, 'TEST', False)):
65+
# if not internal ip, and not DEBUG or TEST
66+
if not (remote_addr in settings.INTERNAL_IPS or settings.DEBUG or getattr(settings, 'TEST', False)):
6967
return False
7068
return True
7169

0 commit comments

Comments
 (0)