bgneal@581
|
1 # Base Django settings for the SG101 website.
|
bgneal@499
|
2
|
bgneal@679
|
3 import json
|
bgneal@499
|
4 import os
|
bgneal@499
|
5 from decimal import Decimal
|
bgneal@499
|
6
|
bgneal@499
|
7 from django.contrib.messages import constants as message_constants
|
bgneal@512
|
8 import djcelery
|
bgneal@515
|
9 from celery.schedules import crontab
|
bgneal@512
|
10
|
bgneal@499
|
11
|
bgneal@499
|
12 PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..'))
|
bgneal@499
|
13
|
bgneal@499
|
14 DEBUG = True
|
bgneal@499
|
15 TEMPLATE_DEBUG = DEBUG
|
bgneal@499
|
16
|
bgneal@499
|
17 ADMINS = (
|
bgneal@499
|
18 ('Brian Neal', 'admin@surfguitar101.com'),
|
bgneal@499
|
19 )
|
bgneal@499
|
20
|
bgneal@499
|
21 MANAGERS = ADMINS
|
bgneal@499
|
22
|
bgneal@499
|
23 AUTH_PROFILE_MODULE = 'bio.userprofile'
|
bgneal@499
|
24
|
bgneal@499
|
25 INTERNAL_IPS = ['127.0.0.1']
|
bgneal@499
|
26
|
bgneal@499
|
27 # Local time zone for this installation. Choices can be found here:
|
bgneal@499
|
28 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
bgneal@499
|
29 # although not all choices may be available on all operating systems.
|
bgneal@499
|
30 # If running in a Windows environment this must be set to the same as your
|
bgneal@499
|
31 # system time zone.
|
bgneal@499
|
32 TIME_ZONE = 'America/Chicago'
|
bgneal@499
|
33
|
bgneal@499
|
34 # Language code for this installation. All choices can be found here:
|
bgneal@499
|
35 # http://www.i18nguy.com/unicode/language-identifiers.html
|
bgneal@499
|
36 LANGUAGE_CODE = 'en-us'
|
bgneal@499
|
37
|
bgneal@499
|
38 SITE_ID = 1
|
bgneal@499
|
39
|
bgneal@499
|
40 # If you set this to False, Django will make some optimizations so as not
|
bgneal@499
|
41 # to load the internationalization machinery.
|
bgneal@499
|
42 USE_I18N = False
|
bgneal@499
|
43
|
bgneal@499
|
44 # Absolute path to the directory that holds media.
|
bgneal@499
|
45 # Example: "/home/media/media.lawrence.com/"
|
bgneal@499
|
46 MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media'))
|
bgneal@499
|
47
|
bgneal@499
|
48 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
bgneal@499
|
49 # trailing slash if there is a path component (optional in other cases).
|
bgneal@499
|
50 # Examples: "http://media.lawrence.com", "http://example.com/media/"
|
bgneal@499
|
51 MEDIA_URL = '/media/'
|
bgneal@499
|
52
|
bgneal@499
|
53 # Staticfiles settings:
|
bgneal@499
|
54 STATICFILES_DIRS = [
|
bgneal@499
|
55 os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')),
|
bgneal@499
|
56 ]
|
bgneal@499
|
57 STATIC_ROOT = '/tmp/test_static_root'
|
bgneal@499
|
58 STATIC_URL = '/static/'
|
bgneal@499
|
59
|
bgneal@499
|
60 # Make this unique, and don't share it with anybody.
|
bgneal@499
|
61 SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json')))
|
bgneal@499
|
62 SECRET_KEY = SECRETS['SECRET_KEY']
|
bgneal@499
|
63
|
bgneal@499
|
64 # List of Loader classes that know how to import templates from various sources.
|
bgneal@499
|
65
|
bgneal@499
|
66 TEMPLATE_LOADERS = (
|
bgneal@499
|
67 'django.template.loaders.filesystem.Loader',
|
bgneal@499
|
68 'django.template.loaders.app_directories.Loader',
|
bgneal@499
|
69 )
|
bgneal@499
|
70
|
bgneal@499
|
71 MIDDLEWARE_CLASSES = [
|
bgneal@499
|
72 'django.middleware.common.CommonMiddleware',
|
bgneal@499
|
73 'django.middleware.csrf.CsrfViewMiddleware',
|
bgneal@499
|
74 'django.contrib.sessions.middleware.SessionMiddleware',
|
bgneal@499
|
75 'django.contrib.messages.middleware.MessageMiddleware',
|
bgneal@499
|
76 'django.contrib.auth.middleware.AuthenticationMiddleware',
|
bgneal@575
|
77 'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
bgneal@581
|
78 'core.middleware.InactiveUserMiddleware',
|
bgneal@581
|
79 'core.middleware.WhosOnline',
|
bgneal@626
|
80 'wiki.middleware.WikiMiddleware',
|
bgneal@499
|
81 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
bgneal@499
|
82 ]
|
bgneal@499
|
83
|
bgneal@581
|
84 ROOT_URLCONF = 'sg101.urls'
|
bgneal@499
|
85
|
bgneal@499
|
86 TEMPLATE_DIRS = (
|
bgneal@499
|
87 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
bgneal@499
|
88 # Always use forward slashes, even on Windows.
|
bgneal@499
|
89 # Don't forget to use absolute paths, not relative paths.
|
bgneal@499
|
90 os.path.join(PROJECT_PATH, 'templates'),
|
bgneal@499
|
91 )
|
bgneal@499
|
92
|
bgneal@499
|
93 TEMPLATE_CONTEXT_PROCESSORS = (
|
bgneal@499
|
94 "django.contrib.auth.context_processors.auth",
|
bgneal@499
|
95 "django.core.context_processors.debug",
|
bgneal@499
|
96 "django.core.context_processors.request",
|
bgneal@499
|
97 "django.core.context_processors.media",
|
bgneal@499
|
98 "django.core.context_processors.static",
|
bgneal@499
|
99 "django.contrib.messages.context_processors.messages",
|
bgneal@499
|
100 )
|
bgneal@499
|
101
|
bgneal@499
|
102 INSTALLED_APPS = [
|
bgneal@499
|
103 'django.contrib.admin',
|
bgneal@499
|
104 'django.contrib.admindocs',
|
bgneal@499
|
105 'django.contrib.auth',
|
bgneal@499
|
106 'django.contrib.contenttypes',
|
bgneal@499
|
107 'django.contrib.flatpages',
|
bgneal@499
|
108 'django.contrib.humanize',
|
bgneal@499
|
109 'django.contrib.messages',
|
bgneal@499
|
110 'django.contrib.sessions',
|
bgneal@499
|
111 'django.contrib.sites',
|
bgneal@499
|
112 'django.contrib.staticfiles',
|
bgneal@512
|
113 'djcelery',
|
bgneal@499
|
114 'elsewhere',
|
bgneal@499
|
115 'haystack',
|
bgneal@499
|
116 'queued_search',
|
bgneal@512
|
117 'tagging',
|
bgneal@499
|
118 'accounts',
|
bgneal@499
|
119 'antispam',
|
bgneal@558
|
120 'banners',
|
bgneal@499
|
121 'bio',
|
bgneal@499
|
122 'bulletins',
|
bgneal@499
|
123 'comments',
|
bgneal@499
|
124 'contact',
|
bgneal@540
|
125 'contests',
|
bgneal@499
|
126 'core',
|
bgneal@525
|
127 'custom_search',
|
bgneal@499
|
128 'donations',
|
bgneal@499
|
129 'downloads',
|
bgneal@499
|
130 'forums',
|
bgneal@499
|
131 'gcalendar',
|
bgneal@499
|
132 'irc',
|
bgneal@499
|
133 'legacy',
|
bgneal@499
|
134 'membermap',
|
bgneal@499
|
135 'messages',
|
bgneal@499
|
136 'news',
|
bgneal@499
|
137 'oembed',
|
bgneal@544
|
138 'phantombrigade',
|
bgneal@499
|
139 'podcast',
|
bgneal@499
|
140 'polls',
|
bgneal@499
|
141 'potd',
|
bgneal@499
|
142 'shoutbox',
|
bgneal@499
|
143 'smiley',
|
bgneal@499
|
144 'weblinks',
|
bgneal@626
|
145 'wiki',
|
bgneal@499
|
146 'ygroup',
|
bgneal@499
|
147 ]
|
bgneal@499
|
148
|
bgneal@683
|
149 LOGIN_URL = 'accounts-login'
|
bgneal@683
|
150 LOGIN_REDIRECT_URL = 'bio-me'
|
bgneal@683
|
151 LOGOUT_URL = 'accounts-logout'
|
bgneal@499
|
152
|
bgneal@499
|
153 FILE_UPLOAD_PERMISSIONS = 0644
|
bgneal@499
|
154 DEFAULT_FROM_EMAIL = ADMINS[0][1]
|
bgneal@499
|
155
|
bgneal@499
|
156 #######################################################################
|
bgneal@499
|
157 # Messages
|
bgneal@499
|
158 #######################################################################
|
bgneal@499
|
159 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
bgneal@499
|
160 MESSAGE_TAGS = {
|
bgneal@499
|
161 message_constants.DEBUG: 'notice',
|
bgneal@499
|
162 message_constants.INFO: 'info',
|
bgneal@499
|
163 message_constants.SUCCESS: 'success',
|
bgneal@499
|
164 message_constants.WARNING: 'alert',
|
bgneal@499
|
165 message_constants.ERROR: 'error',
|
bgneal@499
|
166 }
|
bgneal@499
|
167
|
bgneal@499
|
168 #######################################################################
|
bgneal@499
|
169 # Email
|
bgneal@499
|
170 #######################################################################
|
bgneal@499
|
171 EMAIL_HOST = 'localhost'
|
bgneal@499
|
172 EMAIL_PORT = 1025
|
bgneal@512
|
173 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
bgneal@499
|
174
|
bgneal@499
|
175 #######################################################################
|
bgneal@499
|
176 # Sessions
|
bgneal@499
|
177 #######################################################################
|
bgneal@499
|
178 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
bgneal@499
|
179 SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds
|
bgneal@499
|
180 SESSION_COOKIE_DOMAIN = None
|
bgneal@499
|
181 SESSION_COOKIE_NAME = 'sg101_sessionid'
|
bgneal@499
|
182 SESSION_COOKIE_PATH = '/'
|
bgneal@499
|
183 SESSION_COOKIE_SECURE = False
|
bgneal@499
|
184 SESSION_EXPIRE_AT_BROWSER_CLOSE = False
|
bgneal@499
|
185 SESSION_SAVE_EVERY_REQUEST = False
|
bgneal@499
|
186
|
bgneal@499
|
187 #######################################################################
|
bgneal@499
|
188 # Tagging Specific Settings
|
bgneal@499
|
189 #######################################################################
|
bgneal@499
|
190 FORCE_LOWERCASE_TAGS = True
|
bgneal@499
|
191 MAX_TAG_LENGTH = 50
|
bgneal@499
|
192
|
bgneal@499
|
193 #######################################################################
|
bgneal@499
|
194 # Haystack Search Settings
|
bgneal@499
|
195 #######################################################################
|
bgneal@581
|
196 HAYSTACK_SITECONF = 'sg101.search_sites'
|
bgneal@499
|
197 HAYSTACK_SEARCH_ENGINE = 'xapian'
|
bgneal@499
|
198 HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_PATH, 'xapian_index')
|
bgneal@499
|
199
|
bgneal@499
|
200
|
bgneal@499
|
201 #######################################################################
|
bgneal@522
|
202 # Redis integration & settings
|
bgneal@522
|
203 #######################################################################
|
bgneal@522
|
204 REDIS_HOST = 'localhost'
|
bgneal@522
|
205 REDIS_PORT = 6379
|
bgneal@522
|
206 REDIS_DB = 0
|
bgneal@522
|
207
|
bgneal@522
|
208 #######################################################################
|
bgneal@512
|
209 # Celery integration & settings
|
bgneal@512
|
210 #######################################################################
|
bgneal@512
|
211 BROKER_URL = 'redis://localhost:6379/1'
|
bgneal@512
|
212 BROKER_POOL_LIMIT = 10
|
bgneal@512
|
213
|
bgneal@514
|
214 CELERY_IGNORE_RESULT = True
|
bgneal@512
|
215 CELERY_RESULT_BACKEND = 'redis'
|
bgneal@512
|
216 CELERY_REDIS_HOST = 'localhost'
|
bgneal@512
|
217 CELERY_REDIS_PORT = 6379
|
bgneal@512
|
218 CELERY_REDIS_DB = 1
|
bgneal@512
|
219
|
bgneal@512
|
220 CELERY_DISABLE_RATE_LIMITS = True
|
bgneal@512
|
221 CELERY_SEND_TASK_ERROR_EMAILS = True
|
bgneal@512
|
222
|
bgneal@512
|
223 djcelery.setup_loader()
|
bgneal@512
|
224
|
bgneal@515
|
225 CELERYBEAT_SCHEDULE = {
|
bgneal@515
|
226 "potd": {
|
bgneal@515
|
227 "task": "potd.tasks.pick_potd",
|
bgneal@515
|
228 "schedule": crontab(minute=0, hour=0),
|
bgneal@516
|
229 },
|
bgneal@516
|
230 "cleanup": {
|
bgneal@516
|
231 "task": "core.tasks.cleanup",
|
bgneal@516
|
232 "schedule": crontab(minute=0, hour=1),
|
bgneal@516
|
233 },
|
bgneal@519
|
234 "purge_messages": {
|
bgneal@518
|
235 "task": "messages.tasks.purge_messages",
|
bgneal@518
|
236 "schedule": crontab(minute=30, hour=1, day_of_week='sunday'),
|
bgneal@519
|
237 },
|
bgneal@519
|
238 "max_users": {
|
bgneal@519
|
239 "task": "core.tasks.max_users",
|
bgneal@519
|
240 "schedule": crontab(minute='*/15'),
|
bgneal@519
|
241 },
|
bgneal@525
|
242 "search_queue": {
|
bgneal@525
|
243 "task": "custom_search.tasks.process_search_queue_task",
|
bgneal@525
|
244 "schedule": crontab(minute='*/20'),
|
bgneal@525
|
245 },
|
bgneal@627
|
246 "expire_wiki_cookies": {
|
bgneal@627
|
247 "task": "wiki.tasks.expire_cookies",
|
bgneal@627
|
248 "schedule": crontab(minute=0, hour=2),
|
bgneal@627
|
249 },
|
bgneal@515
|
250 }
|
bgneal@515
|
251
|
bgneal@512
|
252 #######################################################################
|
bgneal@581
|
253 # sg101 Specific Settings
|
bgneal@499
|
254 #######################################################################
|
bgneal@499
|
255 GPP_NO_REPLY_EMAIL = 'no_reply'
|
bgneal@499
|
256 AVATAR_DIR = 'avatars'
|
bgneal@499
|
257 MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024
|
bgneal@499
|
258 MAX_AVATAR_SIZE_PIXELS = 100
|
bgneal@499
|
259 AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png'
|
bgneal@499
|
260
|
bgneal@499
|
261 # Donations application settings:
|
bgneal@499
|
262 DONATIONS_DEBUG = False
|
bgneal@499
|
263 DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com'
|
bgneal@499
|
264 DONATIONS_BUSINESS = 'brian@surfguitar101.com'
|
bgneal@499
|
265 DONATIONS_BUSINESS_DEBUG = 'bgneal_1246137628_biz@gmail.com'
|
bgneal@499
|
266 DONATIONS_GOAL = Decimal('100.00') # monthly goal
|
bgneal@499
|
267 DONATIONS_ANON_NAME = u'Anonymous'
|
bgneal@499
|
268 DONATIONS_ITEM_NUM = '500' # donation w/name listed
|
bgneal@499
|
269 DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous
|
bgneal@499
|
270
|
bgneal@499
|
271 # Oembed settings
|
bgneal@499
|
272 OEMBED_MAXWIDTH = 480
|
bgneal@499
|
273 OEMBED_MAXHEIGHT = 295
|
bgneal@499
|
274
|
bgneal@499
|
275 # GCalendar settings
|
bgneal@499
|
276 GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com'
|
bgneal@499
|
277
|
bgneal@499
|
278 # Google OAuth settings
|
bgneal@499
|
279 GOOGLE_OAUTH_CONSUMER_KEY = 'surfguitar101.com'
|
bgneal@514
|
280 GOOGLE_OAUTH_PRIVATE_KEY_PATH = SECRETS['GOOGLE_KEY_PATH']
|
bgneal@499
|
281
|
bgneal@544
|
282 # Phantom Brigade TeamSpeak3 settings
|
bgneal@614
|
283 PB_TS3_IP = '208.77.144.55'
|
bgneal@544
|
284 PB_TS3_PORT = 10011
|
bgneal@614
|
285 PB_TS3_VID = 17
|
bgneal@544
|
286
|
bgneal@626
|
287 # MoinMoin Wiki integration settings
|
bgneal@626
|
288 WIKI_COOKIE_NAME = 'sg101_wiki'
|
bgneal@626
|
289 WIKI_COOKIE_DOMAIN = '.surfguitar101.com'
|
bgneal@626
|
290 WIKI_COOKIE_AGE = SESSION_COOKIE_AGE
|
bgneal@626
|
291 WIKI_REDIS_SET = 'wiki_cookie_keys'
|
bgneal@626
|
292
|
bgneal@499
|
293 #######################################################################
|
bgneal@499
|
294 # Asynchronous settings (queues, queued_search, redis, celery, etc)
|
bgneal@499
|
295 #######################################################################
|
bgneal@499
|
296 QUEUE_BACKEND = 'redisd'
|
bgneal@499
|
297 QUEUE_REDIS_CONNECTION = 'localhost:6379'
|
bgneal@499
|
298 QUEUE_REDIS_DB = 0
|
bgneal@499
|
299
|
bgneal@499
|
300 #######################################################################
|
bgneal@499
|
301 # Open Graph Protocol related settings
|
bgneal@499
|
302 #######################################################################
|
bgneal@499
|
303 OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg'
|
bgneal@499
|
304 OGP_FB_ID = '100001558124013'
|
bgneal@549
|
305 OGP_SITE_DESCRIPTION = ('The premier community website for friends and fans of'
|
bgneal@549
|
306 ' instrumental surf music. We have forums, podcasts, surf music news, an'
|
bgneal@549
|
307 ' event calendar, and much more! The surf is always up at'
|
bgneal@549
|
308 ' SurfGuitar101.com!')
|
bgneal@499
|
309
|
bgneal@499
|
310 #######################################################################
|
bgneal@499
|
311 # URL's of 3rd party Javascript and CSS files.
|
bgneal@499
|
312 # These dictionaries are used by core/templatetags/script_tags, and
|
bgneal@499
|
313 # should also be used by developers when creating form media classes.
|
bgneal@499
|
314 GPP_THIRD_PARTY_JS = {
|
bgneal@643
|
315 'imagesloaded': [
|
bgneal@643
|
316 'js/jquery.imagesloaded.min.js',
|
bgneal@643
|
317 ],
|
bgneal@499
|
318 'jquery': [
|
bgneal@499
|
319 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',
|
bgneal@499
|
320 ],
|
bgneal@499
|
321 'jquery-jeditable': [
|
bgneal@499
|
322 'js/jquery.jeditable.mini.js',
|
bgneal@499
|
323 ],
|
bgneal@499
|
324 'jquery-ui': [
|
bgneal@499
|
325 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js',
|
bgneal@499
|
326 ],
|
bgneal@499
|
327 'markitup': [
|
bgneal@499
|
328 'js/markitup/jquery.markitup.pack.js',
|
bgneal@499
|
329 'js/markitup/sets/markdown/set.js',
|
bgneal@499
|
330 ],
|
bgneal@499
|
331 'tiny_mce': [
|
bgneal@499
|
332 'js/tiny_mce/tiny_mce.js',
|
bgneal@499
|
333 'js/tiny_mce_init_std.js',
|
bgneal@499
|
334 ],
|
bgneal@499
|
335 }
|
bgneal@499
|
336
|
bgneal@499
|
337 GPP_THIRD_PARTY_CSS = {
|
bgneal@499
|
338 'jquery-ui': [
|
bgneal@499
|
339 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css',
|
bgneal@499
|
340 ],
|
bgneal@499
|
341 'markitup': [
|
bgneal@499
|
342 'js/markitup/skins/markitup/style.css',
|
bgneal@499
|
343 'js/markitup/sets/markdown/style.css',
|
bgneal@499
|
344 ],
|
bgneal@499
|
345 }
|
bgneal@499
|
346
|