[PATCH] Add support for 'django-debug-toolbar'

Stephen Finucane stephen.finucane at intel.com
Tue Mar 15 21:55:32 AEDT 2016


This tool is exceptionally helpful for debugging issues with Django:
install it as part of the 'dev' configuration. This only works on
Django > 1.6, due to a lack of support for older versions in the
upstream.

A note is included to help users avoid the issues seen when running
patchwork on a different machine.

Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
 docs/development.md       | 7 +++++++
 patchwork/settings/dev.py | 7 +++++++
 requirements-dev.txt      | 1 +
 3 files changed, 15 insertions(+)

diff --git a/docs/development.md b/docs/development.md
index d69f42f..1ed317d 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -231,6 +231,13 @@ environment:
 Should you wish to re-enter this environment, simply source the `activate`
 script again.
 
+## Django Debug Toolbar
+
+patchwork installs and enables the 'Django Debug Toolbar' by default. However,
+by default this is only displayed if you are developing on localhost. If
+developing on a different machine, you should configure an SSH tunnel such
+that, for example, `localhost:8000` points to `[DEV_MACHINE_IP]:8000`.
+
 ## Environment Variables
 
 The following environment variables are available to configure settings when
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 21aadb5..8e3fc69 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -18,6 +18,13 @@ from .base import *  # noqa
 # https://docs.djangoproject.com/en/1.6/ref/settings/#core-settings
 #
 
+# Models
+
+if django.VERSION > (1, 6):
+    INSTALLED_APPS += [
+        'debug_toolbar'
+    ]
+
 # Security
 
 SECRET_KEY = '00000000000000000000000000000000000000000000000000'
diff --git a/requirements-dev.txt b/requirements-dev.txt
index d52ce6f..5a62e44 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,2 +1,3 @@
 Django<1.9,>=1.8
+django-debug-toolbar==1.4
 -r requirements-test.txt
-- 
2.0.0



More information about the Patchwork mailing list