2010-04-09 19:43:56 +04:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Django settings for the secret_squirrel project.
|
|
|
|
|
|
|
|
import os
|
2010-04-09 22:33:57 +04:00
|
|
|
import logging
|
2010-04-09 19:43:56 +04:00
|
|
|
|
|
|
|
# Make filepaths relative to settings.
|
|
|
|
ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
path = lambda *a: os.path.join(ROOT, *a)
|
|
|
|
|
|
|
|
ROOT_PACKAGE = os.path.basename(ROOT)
|
|
|
|
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
DEBUG = True
|
|
|
|
TEMPLATE_DEBUG = DEBUG
|
2010-04-09 22:33:57 +04:00
|
|
|
LOG_LEVEL = logging.DEBUG
|
|
|
|
SYSLOG_TAG = "http_app_sso"
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
ADMINS = (
|
|
|
|
# ('Your Name', 'your_email@domain.com'),
|
|
|
|
)
|
|
|
|
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2010-04-09 19:43:56 +04:00
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
2010-04-09 19:59:59 +04:00
|
|
|
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
2010-11-22 21:49:30 +03:00
|
|
|
'NAME': 'squirrel',
|
|
|
|
'USER': '',
|
|
|
|
'PASSWORD': '',
|
|
|
|
'HOST': '',
|
|
|
|
'PORT': '',
|
2010-04-09 19:59:59 +04:00
|
|
|
'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
|
2010-08-09 18:04:01 +04:00
|
|
|
'TEST_CHARSET': 'utf8',
|
|
|
|
'TEST_COLLATION': 'utf8_general_ci',
|
2010-04-09 19:43:56 +04:00
|
|
|
}
|
|
|
|
}
|
2010-04-09 19:09:58 +04:00
|
|
|
|
2010-04-09 19:59:59 +04:00
|
|
|
DATABASE_ROUTERS = ('multidb.MasterSlaveRouter',)
|
|
|
|
|
|
|
|
# Put the aliases for your slave databases in this list
|
|
|
|
SLAVE_DATABASES = []
|
|
|
|
|
|
|
|
# Cache Settings
|
|
|
|
#CACHE_BACKEND = 'caching.backends.memcached://localhost:11211'
|
|
|
|
#CACHE_PREFIX = 'sumo:'
|
|
|
|
|
|
|
|
|
2010-04-09 19:09:58 +04:00
|
|
|
# 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.
|
|
|
|
# If running in a Windows environment this must be set to the same as your
|
|
|
|
# system time zone.
|
2010-04-09 19:43:56 +04:00
|
|
|
TIME_ZONE = 'America/Los_Angeles'
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
|
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
|
|
|
|
|
|
SITE_ID = 1
|
|
|
|
|
|
|
|
# If you set this to False, Django will make some optimizations so as not
|
|
|
|
# to load the internationalization machinery.
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
|
|
# Absolute path to the directory that holds media.
|
|
|
|
# Example: "/home/media/media.lawrence.com/"
|
2010-04-09 19:43:56 +04:00
|
|
|
MEDIA_ROOT = path('media')
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
|
|
|
# trailing slash if there is a path component (optional in other cases).
|
|
|
|
# Examples: "http://media.lawrence.com", "http://example.com/media/"
|
2010-04-09 19:43:56 +04:00
|
|
|
MEDIA_URL = '/media/'
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
|
|
|
|
# trailing slash.
|
|
|
|
# Examples: "http://foo.com/media/", "/media/".
|
2010-04-09 19:43:56 +04:00
|
|
|
ADMIN_MEDIA_PREFIX = '/admin-media/'
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
# Make this unique, and don't share it with anybody.
|
|
|
|
SECRET_KEY = 'bi)(czxyf#e68_bg4lvx!7o*v&ggnz*@()w$z-0injzc#0&)l_'
|
|
|
|
|
2010-04-09 22:33:57 +04:00
|
|
|
# Templates
|
2010-08-02 20:26:19 +04:00
|
|
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
|
|
|
'django.core.context_processors.auth',
|
|
|
|
'django.core.context_processors.debug',
|
|
|
|
'django.core.context_processors.media',
|
|
|
|
'django.core.context_processors.request',
|
|
|
|
'django.core.context_processors.csrf',
|
|
|
|
|
|
|
|
'sso.context_processors.now',
|
|
|
|
)
|
2010-04-09 22:33:57 +04:00
|
|
|
|
|
|
|
TEMPLATE_DIRS = (
|
|
|
|
path('templates'),
|
|
|
|
)
|
|
|
|
|
2010-04-09 19:09:58 +04:00
|
|
|
# List of callables that know how to import templates from various sources.
|
|
|
|
TEMPLATE_LOADERS = (
|
2010-04-09 19:43:56 +04:00
|
|
|
'django.template.loaders.filesystem.Loader',
|
|
|
|
'django.template.loaders.app_directories.Loader',
|
|
|
|
# 'django.template.loaders.eggs.Loader',
|
2010-04-09 19:09:58 +04:00
|
|
|
)
|
|
|
|
|
2010-08-02 20:26:19 +04:00
|
|
|
def JINJA_CONFIG():
|
|
|
|
import jinja2
|
|
|
|
# TODO replace 'jinja2.ext.i18n' with 'tower.template.i18n' when we're
|
|
|
|
# actually doing L10n.
|
|
|
|
config = {'extensions': ['jinja2.ext.i18n', 'jinja2.ext.loopcontrols',
|
|
|
|
'jinja2.ext.with_'],
|
|
|
|
'finalize': lambda x: x if x is not None else ''}
|
|
|
|
return config
|
|
|
|
|
2010-04-09 19:59:59 +04:00
|
|
|
|
2010-04-09 19:09:58 +04:00
|
|
|
MIDDLEWARE_CLASSES = (
|
2010-09-01 17:43:27 +04:00
|
|
|
'commonware.middleware.SetRemoteAddrFromForwardedFor', # First, so all others see the right IP
|
2010-08-09 18:04:01 +04:00
|
|
|
'sso.middleware.HttpOnlyMiddleware', # needs to be before AuthMiddleware
|
2010-04-09 19:09:58 +04:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
2010-09-01 17:43:27 +04:00
|
|
|
'paranoidsessions.ParanoidSessionMiddleware',
|
2010-04-09 19:43:56 +04:00
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
2010-08-03 00:41:46 +04:00
|
|
|
'django.middleware.csrf.CsrfResponseMiddleware',
|
2010-04-09 19:09:58 +04:00
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
2010-04-09 19:43:56 +04:00
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2010-08-24 16:59:47 +04:00
|
|
|
|
|
|
|
'commonware.middleware.FrameOptionsHeader',
|
2010-04-09 19:09:58 +04:00
|
|
|
)
|
|
|
|
|
2010-04-09 19:43:56 +04:00
|
|
|
ROOT_URLCONF = '%s.urls' % ROOT_PACKAGE
|
2010-04-09 19:09:58 +04:00
|
|
|
|
|
|
|
INSTALLED_APPS = (
|
2010-04-15 20:58:43 +04:00
|
|
|
'django.contrib.admin',
|
2010-04-09 19:09:58 +04:00
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
2010-04-09 19:43:56 +04:00
|
|
|
'django.contrib.messages',
|
2010-04-09 22:33:57 +04:00
|
|
|
|
|
|
|
'cas_provider',
|
|
|
|
'sso',
|
2010-04-21 20:04:54 +04:00
|
|
|
'users',
|
2010-04-09 19:09:58 +04:00
|
|
|
)
|
2010-04-09 22:33:57 +04:00
|
|
|
|
2010-10-12 20:10:27 +04:00
|
|
|
AUTHENTICATION_BACKENDS = ('users.auth.Sha256Backend',)
|
2010-08-11 21:42:08 +04:00
|
|
|
AUTH_PROFILE_MODULE = 'users.UserProfile'
|
|
|
|
|
2010-08-09 18:04:01 +04:00
|
|
|
# Tests
|
|
|
|
TEST_RUNNER = 'test_utils.runner.RadicalTestSuiteRunner'
|
|
|
|
|
|
|
|
# Security settings
|
|
|
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
2010-08-09 18:45:32 +04:00
|
|
|
# Default to 1 week expiration
|
|
|
|
SESSION_COOKIE_AGE = 7 * 24 * 60 * 60
|
2010-08-09 18:04:01 +04:00
|
|
|
SESSION_COOKIE_SECURE = True
|
|
|
|
|
|
|
|
# Cookie names that should NOT have the HttpOnly flag set.
|
|
|
|
JAVASCRIPT_READABLE_COOKIES = ()
|
|
|
|
|
2010-09-01 17:43:27 +04:00
|
|
|
# CAS Service ticket expiration, in seconds, 0 means no expiration.
|
2010-08-10 19:44:45 +04:00
|
|
|
SERVICE_TICKET_TIMEOUT = 30
|
|
|
|
|
2010-09-01 17:43:27 +04:00
|
|
|
# django-paranoid-sessions settings
|
|
|
|
PSESSION_CHECK_HEADERS = ('REMOTE_ADDR',) # Check remote IP address
|
|
|
|
PSESSION_NONCE_TIMEOUT = None # No nonce cookies for now
|
|
|
|
|
2010-04-15 20:58:43 +04:00
|
|
|
# Emails
|
|
|
|
DEFAULT_FROM_EMAIL = 'nobody@mozilla.org'
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
2010-04-09 22:33:57 +04:00
|
|
|
|
2010-04-15 20:58:43 +04:00
|
|
|
# Auth
|
2010-04-21 17:46:50 +04:00
|
|
|
LOGIN_URL = '/users/login/'
|
|
|
|
LOGOUT_URL = '/users/logout/'
|
2010-04-14 19:43:39 +04:00
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2010-04-15 20:58:43 +04:00
|
|
|
|
|
|
|
ACCOUNT_ACTIVATION_DAYS = 7
|