Mercurial > public > sg101
comparison gpp/settings/base.py @ 499:1a09a7bea000
For #236, switch to a settings package scheme.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 30 Nov 2011 02:41:18 +0000 |
parents | |
children | 3fd369e1197f |
comparison
equal
deleted
inserted
replaced
498:b137a0966e4b | 499:1a09a7bea000 |
---|---|
1 # Base Django settings for the gpp project. | |
2 | |
3 import os | |
4 from decimal import Decimal | |
5 | |
6 import django.utils.simplejson as json | |
7 from django.contrib.messages import constants as message_constants | |
8 | |
9 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..')) | |
10 | |
11 DEBUG = True | |
12 TEMPLATE_DEBUG = DEBUG | |
13 | |
14 ADMINS = ( | |
15 ('Brian Neal', 'admin@surfguitar101.com'), | |
16 ) | |
17 | |
18 MANAGERS = ADMINS | |
19 | |
20 AUTH_PROFILE_MODULE = 'bio.userprofile' | |
21 | |
22 INTERNAL_IPS = ['127.0.0.1'] | |
23 | |
24 # Local time zone for this installation. Choices can be found here: | |
25 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | |
26 # although not all choices may be available on all operating systems. | |
27 # If running in a Windows environment this must be set to the same as your | |
28 # system time zone. | |
29 TIME_ZONE = 'America/Chicago' | |
30 | |
31 # Language code for this installation. All choices can be found here: | |
32 # http://www.i18nguy.com/unicode/language-identifiers.html | |
33 LANGUAGE_CODE = 'en-us' | |
34 | |
35 SITE_ID = 1 | |
36 | |
37 # If you set this to False, Django will make some optimizations so as not | |
38 # to load the internationalization machinery. | |
39 USE_I18N = False | |
40 | |
41 # Absolute path to the directory that holds media. | |
42 # Example: "/home/media/media.lawrence.com/" | |
43 MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media')) | |
44 | |
45 # URL that handles the media served from MEDIA_ROOT. Make sure to use a | |
46 # trailing slash if there is a path component (optional in other cases). | |
47 # Examples: "http://media.lawrence.com", "http://example.com/media/" | |
48 MEDIA_URL = '/media/' | |
49 | |
50 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a | |
51 # trailing slash. | |
52 # Examples: "http://foo.com/media/", "/media/". | |
53 ADMIN_MEDIA_PREFIX = '/static/admin/' | |
54 | |
55 # Staticfiles settings: | |
56 STATICFILES_DIRS = [ | |
57 os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')), | |
58 ] | |
59 STATIC_ROOT = '/tmp/test_static_root' | |
60 STATIC_URL = '/static/' | |
61 | |
62 # Make this unique, and don't share it with anybody. | |
63 SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json'))) | |
64 SECRET_KEY = SECRETS['SECRET_KEY'] | |
65 | |
66 # List of Loader classes that know how to import templates from various sources. | |
67 | |
68 TEMPLATE_LOADERS = ( | |
69 'django.template.loaders.filesystem.Loader', | |
70 'django.template.loaders.app_directories.Loader', | |
71 ) | |
72 | |
73 MIDDLEWARE_CLASSES = [ | |
74 'django.middleware.common.CommonMiddleware', | |
75 'django.middleware.csrf.CsrfViewMiddleware', | |
76 'django.contrib.sessions.middleware.SessionMiddleware', | |
77 'django.contrib.messages.middleware.MessageMiddleware', | |
78 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
79 'gpp.core.middleware.InactiveUserMiddleware', | |
80 'gpp.core.middleware.WhosOnline', | |
81 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', | |
82 ] | |
83 | |
84 ROOT_URLCONF = 'gpp.urls' | |
85 | |
86 TEMPLATE_DIRS = ( | |
87 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | |
88 # Always use forward slashes, even on Windows. | |
89 # Don't forget to use absolute paths, not relative paths. | |
90 os.path.join(PROJECT_PATH, 'templates'), | |
91 ) | |
92 | |
93 TEMPLATE_CONTEXT_PROCESSORS = ( | |
94 "django.contrib.auth.context_processors.auth", | |
95 "django.core.context_processors.debug", | |
96 "django.core.context_processors.request", | |
97 "django.core.context_processors.media", | |
98 "django.core.context_processors.static", | |
99 "django.contrib.messages.context_processors.messages", | |
100 ) | |
101 | |
102 INSTALLED_APPS = [ | |
103 'django.contrib.admin', | |
104 'django.contrib.admindocs', | |
105 'django.contrib.auth', | |
106 'django.contrib.contenttypes', | |
107 'django.contrib.flatpages', | |
108 'django.contrib.humanize', | |
109 'django.contrib.markup', | |
110 'django.contrib.messages', | |
111 'django.contrib.sessions', | |
112 'django.contrib.sites', | |
113 'django.contrib.staticfiles', | |
114 'elsewhere', | |
115 'tagging', | |
116 'haystack', | |
117 'queued_search', | |
118 'accounts', | |
119 'antispam', | |
120 'bio', | |
121 'bulletins', | |
122 'comments', | |
123 'contact', | |
124 'core', | |
125 'donations', | |
126 'downloads', | |
127 'forums', | |
128 'gcalendar', | |
129 'irc', | |
130 'legacy', | |
131 'mailer', | |
132 'membermap', | |
133 'messages', | |
134 'news', | |
135 'oembed', | |
136 'podcast', | |
137 'polls', | |
138 'potd', | |
139 'shoutbox', | |
140 'smiley', | |
141 'weblinks', | |
142 'ygroup', | |
143 ] | |
144 | |
145 LOGIN_URL = '/accounts/login/' | |
146 LOGIN_REDIRECT_URL = '/profile/me/' | |
147 LOGOUT_URL = '/accounts/logout/' | |
148 | |
149 FILE_UPLOAD_PERMISSIONS = 0644 | |
150 DEFAULT_FROM_EMAIL = ADMINS[0][1] | |
151 | |
152 ####################################################################### | |
153 # Messages | |
154 ####################################################################### | |
155 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' | |
156 MESSAGE_TAGS = { | |
157 message_constants.DEBUG: 'notice', | |
158 message_constants.INFO: 'info', | |
159 message_constants.SUCCESS: 'success', | |
160 message_constants.WARNING: 'alert', | |
161 message_constants.ERROR: 'error', | |
162 } | |
163 | |
164 ####################################################################### | |
165 # Email | |
166 ####################################################################### | |
167 EMAIL_HOST = 'localhost' | |
168 EMAIL_PORT = 1025 | |
169 | |
170 ####################################################################### | |
171 # Sessions | |
172 ####################################################################### | |
173 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" | |
174 SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds | |
175 SESSION_COOKIE_DOMAIN = None | |
176 SESSION_COOKIE_NAME = 'sg101_sessionid' | |
177 SESSION_COOKIE_PATH = '/' | |
178 SESSION_COOKIE_SECURE = False | |
179 SESSION_EXPIRE_AT_BROWSER_CLOSE = False | |
180 SESSION_SAVE_EVERY_REQUEST = False | |
181 | |
182 ####################################################################### | |
183 # Tagging Specific Settings | |
184 ####################################################################### | |
185 FORCE_LOWERCASE_TAGS = True | |
186 MAX_TAG_LENGTH = 50 | |
187 | |
188 ####################################################################### | |
189 # Haystack Search Settings | |
190 ####################################################################### | |
191 HAYSTACK_SITECONF = 'gpp.search_sites' | |
192 HAYSTACK_SEARCH_ENGINE = 'xapian' | |
193 HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_PATH, 'xapian_index') | |
194 | |
195 | |
196 ####################################################################### | |
197 # GPP Specific Settings | |
198 ####################################################################### | |
199 GPP_LOG_LEVEL = 0 | |
200 GPP_SEND_EMAIL = False | |
201 GPP_NO_REPLY_EMAIL = 'no_reply' | |
202 AVATAR_DIR = 'avatars' | |
203 MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024 | |
204 MAX_AVATAR_SIZE_PIXELS = 100 | |
205 AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png' | |
206 | |
207 # Donations application settings: | |
208 DONATIONS_DEBUG = False | |
209 DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com' | |
210 DONATIONS_BUSINESS = 'brian@surfguitar101.com' | |
211 DONATIONS_BUSINESS_DEBUG = 'bgneal_1246137628_biz@gmail.com' | |
212 DONATIONS_GOAL = Decimal('100.00') # monthly goal | |
213 DONATIONS_ANON_NAME = u'Anonymous' | |
214 DONATIONS_ITEM_NUM = '500' # donation w/name listed | |
215 DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous | |
216 | |
217 # If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the | |
218 # mailer application's mail queue (database table). It is then expected | |
219 # that a daemon or cron job will actually send the mail out. If | |
220 # MAILER_ENQUEUE_MAIL is False, then email will only be sent if | |
221 # the setting GPP_SEND_EMAIL (above) is True. In any event, emails | |
222 # will be logged via the Python logger if the Python logger filter | |
223 # DEBUG is active. | |
224 | |
225 MAILER_ENQUEUE_MAIL = True | |
226 | |
227 # Oembed settings | |
228 OEMBED_MAXWIDTH = 480 | |
229 OEMBED_MAXHEIGHT = 295 | |
230 | |
231 # GCalendar settings | |
232 GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com' | |
233 | |
234 # Google OAuth settings | |
235 GOOGLE_OAUTH_CONSUMER_KEY = 'surfguitar101.com' | |
236 GOOGLE_OAUTH_PRIVATE_KEY_PATH = '/home/brian/google/myrsakey.pem' | |
237 | |
238 ####################################################################### | |
239 # Asynchronous settings (queues, queued_search, redis, celery, etc) | |
240 ####################################################################### | |
241 QUEUE_BACKEND = 'redisd' | |
242 QUEUE_REDIS_CONNECTION = 'localhost:6379' | |
243 QUEUE_REDIS_DB = 0 | |
244 | |
245 ####################################################################### | |
246 # Open Graph Protocol related settings | |
247 ####################################################################### | |
248 OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg' | |
249 OGP_FB_ID = '100001558124013' | |
250 | |
251 ####################################################################### | |
252 # URL's of 3rd party Javascript and CSS files. | |
253 # These dictionaries are used by core/templatetags/script_tags, and | |
254 # should also be used by developers when creating form media classes. | |
255 GPP_THIRD_PARTY_JS = { | |
256 'jquery': [ | |
257 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', | |
258 ], | |
259 'jquery-jeditable': [ | |
260 'js/jquery.jeditable.mini.js', | |
261 ], | |
262 'jquery-ui': [ | |
263 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', | |
264 ], | |
265 'markitup': [ | |
266 'js/markitup/jquery.markitup.pack.js', | |
267 'js/markitup/sets/markdown/set.js', | |
268 ], | |
269 'tiny_mce': [ | |
270 'js/tiny_mce/tiny_mce.js', | |
271 'js/tiny_mce_init_std.js', | |
272 ], | |
273 } | |
274 | |
275 GPP_THIRD_PARTY_CSS = { | |
276 'jquery-ui': [ | |
277 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css', | |
278 ], | |
279 'markitup': [ | |
280 'js/markitup/skins/markitup/style.css', | |
281 'js/markitup/sets/markdown/style.css', | |
282 ], | |
283 } | |
284 |