changeset 188:d293b423bdaf

Adding support for the django debug toolbar.
author Brian Neal <bgneal@gmail.com>
date Wed, 31 Mar 2010 01:58:20 +0000
parents a9ea104f49ed
children db202792d9f5
files gpp/settings.py
diffstat 1 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/settings.py	Wed Mar 31 01:23:57 2010 +0000
+++ b/gpp/settings.py	Wed Mar 31 01:58:20 2010 +0000
@@ -73,14 +73,25 @@
         )),
     )
 
-MIDDLEWARE_CLASSES = (
-    'django.middleware.common.CommonMiddleware',
-    'django.contrib.sessions.middleware.SessionMiddleware',
-    'django.contrib.messages.middleware.MessageMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
-    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
-    'gpp.forums.middleware.WhosOnline',
-)
+if DEBUG:
+    MIDDLEWARE_CLASSES = (
+        'django.middleware.common.CommonMiddleware',
+        'django.contrib.sessions.middleware.SessionMiddleware',
+        'django.contrib.messages.middleware.MessageMiddleware',
+        'debug_toolbar.middleware.DebugToolbarMiddleware',
+        'django.contrib.auth.middleware.AuthenticationMiddleware',
+        'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+        'gpp.forums.middleware.WhosOnline',
+    )
+else:
+    MIDDLEWARE_CLASSES = (
+        'django.middleware.common.CommonMiddleware',
+        'django.contrib.sessions.middleware.SessionMiddleware',
+        'django.contrib.messages.middleware.MessageMiddleware',
+        'django.contrib.auth.middleware.AuthenticationMiddleware',
+        'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+        'gpp.forums.middleware.WhosOnline',
+    )
 
 ROOT_URLCONF = 'gpp.urls'
 
@@ -100,7 +111,7 @@
     "django.contrib.messages.context_processors.messages",
 )
 
-INSTALLED_APPS = (
+INSTALLED_APPS = [
     'django.contrib.admin',
     'django.contrib.admindocs',
     'django.contrib.auth',
@@ -134,7 +145,9 @@
     'shoutbox',
     'smiley',
     'weblinks',
-)
+]
+if DEBUG:
+    INSTALLED_APPS.append('debug_toolbar')
 
 LOGIN_URL = '/accounts/login/'
 LOGIN_REDIRECT_URL = '/profile/me/'