Skip to content

Commit

Permalink
Merge pull request #439 from freedomofpress/debug-toolbar-updates
Browse files Browse the repository at this point in the history
Debug toolbar updates
  • Loading branch information
msheiny authored Apr 17, 2018
2 parents 7846747 + 7d0a3d5 commit 7fe9d7b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
3 changes: 3 additions & 0 deletions debug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This app contains resources specific to local development that are not needed
for production. Currently that only includes a local copy of jQuery
specifically for use by django-debug-toobar.
Empty file added debug/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions debug/static/debug/jquery.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r requirements.txt
django-debug-toolbar
django-debug-toolbar>=1.9
flake8
ipdb
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defusedxml==0.5.0
django-allauth-2fa==0.4.4
django-allauth==0.34.0
django-anymail[mailgun]==1.4
django-debug-toolbar==1.8
django-debug-toolbar==1.9.1
django-modelcluster==3.1
django-otp==0.4.1.1
django-recaptcha==1.3.1
Expand Down
11 changes: 2 additions & 9 deletions securedrop/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,15 @@
pass

if settings.DEBUG:
# Fix for https://github.com/jazzband/django-debug-toolbar/issues/950
DEBUG_TOOLBAR_CONFIG = {
'SKIP_TEMPLATE_PREFIXES': (
'django/forms/widgets/',
'admin/widgets/',
),
'DISABLE_PANELS': {
'debug_toolbar.panels.redirects.RedirectsPanel',
'debug_toolbar.panels.redirects.TemplatesPanel'
},
'JQUERY_URL': STATIC_URL + 'debug/jquery.js', # noqa: F405
}

# Obtain the default gateway from docker, needed for
# debug toolbar whitelisting
docker_gw = subprocess.check_output('ip r | head -n 1', shell=True)
INSTALLED_APPS.append('debug_toolbar') # noqa: F405
INSTALLED_APPS.append('debug') # noqa: F405
# Needs to be injected relatively early in the MIDDLEWARE list
MIDDLEWARE.insert(4, 'debug_toolbar.middleware.DebugToolbarMiddleware') # noqa: F405
INTERNAL_IPS = [docker_gw.split()[2].decode("utf-8")]
Expand Down

0 comments on commit 7fe9d7b

Please sign in to comment.