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