annotate mysite/settings/base.py @ 34:903260593491

Reworking settings.py to a settings package.
author Brian Neal <bgneal@gmail.com>
date Tue, 29 Nov 2011 03:14:25 +0000
parents
children 25e00d1b99bf
rev   line source
bgneal@34 1 # Base Django settings for madeira project.
bgneal@34 2
bgneal@34 3 import os
bgneal@34 4 import django.utils.simplejson as json
bgneal@34 5
bgneal@34 6 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..'))
bgneal@34 7
bgneal@34 8 DEBUG = True
bgneal@34 9 TEMPLATE_DEBUG = DEBUG
bgneal@34 10
bgneal@34 11 ADMINS = [
bgneal@34 12 ('Brian Neal', 'admin@surfguitar101.com'),
bgneal@34 13 ]
bgneal@34 14
bgneal@34 15 MANAGERS = ADMINS
bgneal@34 16
bgneal@34 17 INTERNAL_IPS = ['127.0.0.1']
bgneal@34 18
bgneal@34 19 # Local time zone for this installation. Choices can be found here:
bgneal@34 20 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
bgneal@34 21 # although not all choices may be available on all operating systems.
bgneal@34 22 # If running in a Windows environment this must be set to the same as your
bgneal@34 23 # system time zone.
bgneal@34 24 TIME_ZONE = 'America/Chicago'
bgneal@34 25
bgneal@34 26 # Language code for this installation. All choices can be found here:
bgneal@34 27 # http://www.i18nguy.com/unicode/language-identifiers.html
bgneal@34 28 LANGUAGE_CODE = 'en-us'
bgneal@34 29
bgneal@34 30 SITE_ID = 1
bgneal@34 31
bgneal@34 32 # If you set this to False, Django will make some optimizations so as not
bgneal@34 33 # to load the internationalization machinery.
bgneal@34 34 USE_I18N = False
bgneal@34 35
bgneal@34 36 # Absolute path to the directory that holds media.
bgneal@34 37 # Example: "/home/media/media.lawrence.com/"
bgneal@34 38 MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media'))
bgneal@34 39
bgneal@34 40 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
bgneal@34 41 # trailing slash if there is a path component (optional in other cases).
bgneal@34 42 # Examples: "http://media.lawrence.com", "http://example.com/media/"
bgneal@34 43 MEDIA_URL = '/media/'
bgneal@34 44
bgneal@34 45 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
bgneal@34 46 # trailing slash.
bgneal@34 47 # Examples: "http://foo.com/media/", "/media/".
bgneal@34 48 ADMIN_MEDIA_PREFIX = '/static/admin/'
bgneal@34 49
bgneal@34 50 # Staticfiles settings:
bgneal@34 51 STATICFILES_DIRS = [
bgneal@34 52 os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')),
bgneal@34 53 ]
bgneal@34 54 STATIC_ROOT = '/tmp/test_madeira_static_root'
bgneal@34 55 STATIC_URL = '/static/'
bgneal@34 56
bgneal@34 57 # Make this unique, and don't share it with anybody.
bgneal@34 58 SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json')))
bgneal@34 59 SECRET_KEY = SECRETS['SECRET_KEY']
bgneal@34 60
bgneal@34 61 TEMPLATE_LOADERS = [
bgneal@34 62 'django.template.loaders.filesystem.Loader',
bgneal@34 63 'django.template.loaders.app_directories.Loader',
bgneal@34 64 # 'django.template.loaders.eggs.Loader',
bgneal@34 65 ]
bgneal@34 66
bgneal@34 67 MIDDLEWARE_CLASSES = [
bgneal@34 68 'django.middleware.common.CommonMiddleware',
bgneal@34 69 'django.middleware.csrf.CsrfViewMiddleware',
bgneal@34 70 'django.contrib.sessions.middleware.SessionMiddleware',
bgneal@34 71 'django.contrib.messages.middleware.MessageMiddleware',
bgneal@34 72 'django.contrib.auth.middleware.AuthenticationMiddleware',
bgneal@34 73 'django.middleware.doc.XViewMiddleware',
bgneal@34 74 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
bgneal@34 75 ]
bgneal@34 76
bgneal@34 77 ROOT_URLCONF = 'mysite.urls'
bgneal@34 78
bgneal@34 79 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
bgneal@34 80 # Always use forward slashes, even on Windows.
bgneal@34 81 # Don't forget to use absolute paths, not relative paths.
bgneal@34 82 TEMPLATE_DIRS = [
bgneal@34 83 os.path.join(PROJECT_PATH, 'templates'),
bgneal@34 84 os.path.join(PROJECT_PATH, 'templates', 'band'),
bgneal@34 85 os.path.join(PROJECT_PATH, 'photologue', 'templates'),
bgneal@34 86 ]
bgneal@34 87
bgneal@34 88 TEMPLATE_CONTEXT_PROCESSORS = [
bgneal@34 89 "django.contrib.auth.context_processors.auth",
bgneal@34 90 "django.core.context_processors.debug",
bgneal@34 91 "django.core.context_processors.request",
bgneal@34 92 "django.core.context_processors.media",
bgneal@34 93 "django.core.context_processors.static",
bgneal@34 94 "django.contrib.messages.context_processors.messages",
bgneal@34 95 ]
bgneal@34 96
bgneal@34 97 INSTALLED_APPS = [
bgneal@34 98 'django.contrib.admin',
bgneal@34 99 'django.contrib.admindocs',
bgneal@34 100 'django.contrib.auth',
bgneal@34 101 'django.contrib.contenttypes',
bgneal@34 102 'django.contrib.flatpages',
bgneal@34 103 'django.contrib.markup',
bgneal@34 104 'django.contrib.messages',
bgneal@34 105 'django.contrib.sessions',
bgneal@34 106 'django.contrib.sites',
bgneal@34 107 'django.contrib.staticfiles',
bgneal@34 108 'mysite.band',
bgneal@34 109 'mysite.photologue',
bgneal@34 110 ]
bgneal@34 111
bgneal@34 112 #######################################################################
bgneal@34 113 # Messages
bgneal@34 114 #######################################################################
bgneal@34 115 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
bgneal@34 116
bgneal@34 117 #######################################################################
bgneal@34 118 # Email
bgneal@34 119 #######################################################################
bgneal@34 120 EMAIL_HOST = 'localhost'
bgneal@34 121 EMAIL_PORT = 1025
bgneal@34 122
bgneal@34 123 #######################################################################
bgneal@34 124 # Sessions
bgneal@34 125 #######################################################################
bgneal@34 126 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
bgneal@34 127 SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds
bgneal@34 128 SESSION_COOKIE_DOMAIN = None
bgneal@34 129 SESSION_COOKIE_NAME = 'madeira_sessionid'
bgneal@34 130 SESSION_COOKIE_PATH = '/'
bgneal@34 131 SESSION_COOKIE_SECURE = False
bgneal@34 132 SESSION_EXPIRE_AT_BROWSER_CLOSE = False
bgneal@34 133 SESSION_SAVE_EVERY_REQUEST = False