accounts: Add context_processor and middleware.
[xnet] / xnet / settings.py
index 014d798..a23093c 100644 (file)
@@ -30,9 +30,12 @@ AUTHENTICATION_BACKENDS = (
 AUTHGROUPEX_KEY = read_pass('authgroupex.key')
 AUTHGROUPEX_FIELDS = ('username', 'firstname', 'lastname', 'perms')
 AUTHGROUPEX_SUPERADMIN_PERMS = ('admin',)
+AUTHGROUPEX_USER_MODEL = 'accounts.Account'
 LOGIN_URL = '/xorgauth/'
 LOGIN_REDIRECT_URL = '/'
 
+AUTH_USER_MODEL = 'accounts.Account'
+
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 # although not all choices may be available on all operating systems.
@@ -46,6 +49,16 @@ OCALE_PATHS = (
     os.path.join(ROOT_DIR, 'locale'),
 )
 
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.contrib.auth.context_processors.auth',
+    'django.core.context_processors.debug',
+    'django.core.context_processors.i18n',
+    'django.core.context_processors.media',
+    'django.core.context_processors.static',
+    'django.core.context_processors.tz',
+    'django.contrib.messages.context_processors.messages',
+    'xnet.accounts.context_processors.xnet',
+)
 
 SITE_ID = 1
 
@@ -62,12 +75,12 @@ USE_TZ = True
 
 # Absolute filesystem path to the directory that will hold user-uploaded files.
 # Example: "/home/media/media.lawrence.com/media/"
-MEDIA_ROOT = ''
+MEDIA_ROOT = os.path.join(ROOT_DIR, 'media')
 
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash.
 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
-MEDIA_URL = ''
+MEDIA_URL = '/media/'
 
 # Absolute path to the directory static files should be collected to.
 # Don't put anything in this directory yourself; store your static files
@@ -81,6 +94,7 @@ STATIC_URL = '/static/'
 
 # Additional locations of static files
 STATICFILES_DIRS = (
+    os.path.join(ROOT_DIR, 'static'),
     # Put strings here, like "/home/html/static" or "C:/www/django/static".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
@@ -95,7 +109,7 @@ STATICFILES_FINDERS = (
 )
 
 # Make this unique, and don't share it with anybody.
-SECRET_KEY = 'iq9w_94mr$p$a3sr%*cnvt8z($-)zjk1o8wx45dw(6z3%(mwzo'
+SECRET_KEY = 'FOR DEV ONLY!!'
 
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
@@ -109,6 +123,7 @@ MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'xnet.accounts.middleware.XnetAccountMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     # Uncomment the next line for simple clickjacking protection:
     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
@@ -136,8 +151,11 @@ INSTALLED_APPS = (
     'django.contrib.admin',
 
     'django_authgroupex',
+    'crispy_forms',
     'xnet.site',
-    'xnet.group',
+    'xnet.accounts',
+    'xnet.news',
+    'xnet.events',
     'xnet.example',
 )
 
@@ -169,3 +187,5 @@ LOGGING = {
         },
     }
 }
+
+CRISPY_TEMPLATE_PACK = 'bootstrap'