Skip to content

Commit

Permalink
Merge pull request #501 from Cadasta/infrastructure/django-debug-toolbar
Browse files Browse the repository at this point in the history
Add support for Django debug toolbar
  • Loading branch information
oliverroick authored Jul 22, 2016
2 parents bcb1617 + c891571 commit eeb3cd7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cadasta/config/settings/dev_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from .dev import * # NOQA


INSTALLED_APPS = (
'debug_toolbar',
) + INSTALLED_APPS # NOQA

MIDDLEWARE_CLASSES = (
'debug_toolbar.middleware.DebugToolbarMiddleware',
) + MIDDLEWARE_CLASSES # NOQA


INTERNAL_IPS = ('0.0.0.0',)

DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
)


def always(*args):
return True

DEBUG_TOOLBAR_CONFIG = {
'SHOW_TOOLBAR_CALLBACK': always,
}
17 changes: 17 additions & 0 deletions cadasta/runserver
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
#!/bin/bash

if [[ $# == 0 ]]
then
mode=DEFAULT
elif [[ $# == 1 && "$1" == '--debug' ]]
then
mode=DEBUG
else
echo "Usage: runserver [--debug]"
exit 1
fi

if [ $mode == DEBUG ]
then
export DJANGO_SETTINGS_MODULE=config.settings.dev_debug
fi

exec ./manage.py runserver 0.0.0.0:8000
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ transifex-client==0.11
django-compressor==2.0
tox==2.3.1
flake8==2.5.4
django-debug-toolbar==1.5

0 comments on commit eeb3cd7

Please sign in to comment.