diff mysite/settings.py @ 26:efb2da0b5d10

Merging the django1.3 branch into trunk.
author Brian Neal <bgneal@gmail.com>
date Wed, 30 Mar 2011 00:16:32 +0000
parents 0dcfcdf50c62
children
line wrap: on
line diff
--- a/mysite/settings.py	Sun Mar 20 19:53:35 2011 +0000
+++ b/mysite/settings.py	Wed Mar 30 00:16:32 2011 +0000
@@ -14,12 +14,7 @@
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = local_settings.DATABASE_ENGINE
-DATABASE_NAME = local_settings.DATABASE_NAME
-DATABASE_USER = local_settings.DATABASE_USER
-DATABASE_PASSWORD = local_settings.DATABASE_PASSWORD
-DATABASE_HOST = local_settings.DATABASE_HOST
-DATABASE_PORT = local_settings.DATABASE_PORT
+DATABASES = local_settings.DATABASES
 
 INTERNAL_IPS = local_settings.INTERNAL_IPS
 
@@ -54,22 +49,57 @@
 # Examples: "http://foo.com/media/", "/media/".
 ADMIN_MEDIA_PREFIX = local_settings.ADMIN_MEDIA_PREFIX
 
+# Staticfiles settings:
+STATICFILES_DIRS = local_settings.STATICFILES_DIRS
+STATIC_ROOT = local_settings.STATIC_ROOT
+STATIC_URL = local_settings.STATIC_URL
+
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = local_settings.SECRET_KEY
 
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
-)
+if DEBUG:
+    TEMPLATE_LOADERS = (
+        'django.template.loaders.filesystem.Loader',
+        'django.template.loaders.app_directories.Loader',
+    )
+else:
+    TEMPLATE_LOADERS = (
+        ('django.template.loaders.cached.Loader', (
+            'django.template.loaders.filesystem.Loader',
+            'django.template.loaders.app_directories.Loader',
+        )),
+    )
 
-if not DEBUG:
-   CACHE_BACKEND = local_settings.CACHE_BACKEND 
-   CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS 
-   CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX 
-   CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY 
+if DEBUG:
+    MIDDLEWARE_CLASSES = (
+        'django.middleware.common.CommonMiddleware',
+        'django.middleware.csrf.CsrfViewMiddleware',
+        'django.contrib.sessions.middleware.SessionMiddleware',
+        'django.contrib.messages.middleware.MessageMiddleware',
+        'debug_toolbar.middleware.DebugToolbarMiddleware',
+        'django.contrib.auth.middleware.AuthenticationMiddleware',
+        'django.middleware.doc.XViewMiddleware',
+        'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+    )
+else:
+    MIDDLEWARE_CLASSES = (
+        'django.middleware.common.CommonMiddleware',
+        'django.middleware.csrf.CsrfViewMiddleware',
+        'django.contrib.sessions.middleware.SessionMiddleware',
+        'django.contrib.messages.middleware.MessageMiddleware',
+        'django.contrib.auth.middleware.AuthenticationMiddleware',
+        'django.middleware.doc.XViewMiddleware',
+        'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+    )
 
-MIDDLEWARE_CLASSES = local_settings.MIDDLEWARE_CLASSES 
+#######################################################################
+# Caching
+#######################################################################
+if local_settings.USE_CACHE:
+    CACHES = local_settings.CACHES
+    CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY
+    CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS
+    CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX
 
 ROOT_URLCONF = 'mysite.urls'
 
@@ -83,20 +113,64 @@
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (
-   'django.core.context_processors.auth',
-   'django.core.context_processors.debug',
-   'django.core.context_processors.media',
-   'django.core.context_processors.request'
+    "django.contrib.auth.context_processors.auth",
+    "django.core.context_processors.debug",
+    "django.core.context_processors.request",
+    "django.core.context_processors.media",
+    "django.core.context_processors.static",
+    "django.contrib.messages.context_processors.messages",
 )
 
-INSTALLED_APPS = (
+INSTALLED_APPS = [
+    'django.contrib.admin',
+    'django.contrib.admindocs',
     'django.contrib.auth',
     'django.contrib.contenttypes',
+    'django.contrib.flatpages',
+    'django.contrib.markup',
+    'django.contrib.messages',
     'django.contrib.sessions',
-    'django.contrib.admin',
-    'django.contrib.markup',
     'django.contrib.sites',
-    'django.contrib.flatpages',
+    'django.contrib.staticfiles',
     'mysite.band',
     'mysite.photologue',
-)
+]
+if DEBUG:
+    INSTALLED_APPS.append('debug_toolbar')
+
+#######################################################################
+# Messages
+#######################################################################
+MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
+
+#######################################################################
+# Email
+#######################################################################
+EMAIL_HOST = local_settings.EMAIL_HOST
+EMAIL_PORT = local_settings.EMAIL_PORT
+
+#######################################################################
+# Sessions
+#######################################################################
+SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
+SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60   # 2 weeks in seconds
+SESSION_COOKIE_DOMAIN = None
+SESSION_COOKIE_NAME = 'madeira_sessionid'
+SESSION_COOKIE_PATH = '/'
+SESSION_COOKIE_SECURE = False
+SESSION_EXPIRE_AT_BROWSER_CLOSE = False
+SESSION_SAVE_EVERY_REQUEST = False
+
+#######################################################################
+# Configure Logging
+#######################################################################
+
+LOGGING = local_settings.LOGGING
+
+#######################################################################
+# Django Debug Toolbar 
+#######################################################################
+
+if DEBUG:
+    DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG
+