-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
executable file
·397 lines (320 loc) · 10.5 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# -*- coding:utf-8 -*-
# Django settings for imaginationforpeople project.
import os
import re
import sys
import socket
from django.utils.translation import ugettext_lazy as _
# Import settings for the given site
from site_settings import *
PROJECT_ROOT = os.path.dirname(__file__)
sys.path.append(os.path.join(PROJECT_ROOT, '..'))
ADMINS = (
('Simon Sarazin', '[email protected]'),
('Guillaume Libersat', '[email protected]'),
('Alban Tiberghien', '[email protected]'),
)
MANAGERS = (
('IP Team', '[email protected]'),
)
MANAGERS += ADMINS
## Project path
PROJECT_PATH = os.path.abspath('%s' % os.path.dirname(__file__))
# 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.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Paris'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en'
LANGUAGES = (
('en', u'English'),
('fr', u'Français'),
('el', u'Ελληνικά'),
('es', u'Español'),
('pt', u'Português'),
('de', u'Deutsch'),
('it', u'Italiano'),
('ru', u'Русский'),
('zh', u'中文'),
)
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
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media/')
# Make this unique, and don't share it with anybody.
SECRET_KEY = '-m2v@6wb7+$!*nsed$1m5_f=1p5pf-lg^_m3+@x*%fl5a$qpqd'
# Cache
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'linaro_django_pagination.middleware.PaginationMiddleware',
'reversion.middleware.RevisionMiddleware',
'userena.middleware.UserenaLocaleMiddleware',
# 'cms.middleware.multilingual.MultilingualURLMiddleware',
'localeurl.middleware.LocaleURLMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
)
if DEBUG:
MIDDLEWARE_CLASSES += (
'debug_toolbar.middleware.DebugToolbarMiddleware',
)
AUTHENTICATION_BACKENDS = (
'userena.backends.UserenaAuthenticationBackend',
'guardian.backends.ObjectPermissionBackend',
'django.contrib.auth.backends.ModelBackend',
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
'backcap.context_processors.backcap_forms',
'django.core.context_processors.static',
'apps.project_sheet.context_processors.project_search_forms',
'apps.member.context_processors.member_forms',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
)
ROOT_URLCONF = 'imaginationforpeople.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(PROJECT_PATH, 'apps/member/templates'),
os.path.join(PROJECT_PATH, 'apps/i4p_base/templates'),
os.path.join(PROJECT_PATH, 'apps/project_sheet/templates'),
)
INSTALLED_APPS = (
# External Apps
'localeurl',
'dajaxice',
'dajax',
'south',
'django_nose',
'django_extensions',
'userena',
'guardian',
'nani',
'tinymce',
'rosetta',
'tagging',
'imagekit',
'oembed_works',
'reversion',
'django_countries',
'easy_thumbnails',
'licenses',
'haystack',
'voting',
'notification',
'backcap',
'compressor',
'robots',
'ajax_select',
'ajaxcomments',
'django_mailman',
'linaro_django_pagination',
'template_utils',
'simplegravatar',
#'grappelli',
'filebrowser',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.comments',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.syndication',
'emencia.django.newsletter',
'cms',
'mptt',
'menus',
'sekizai',
'cms.plugins.text',
'cms.plugins.link',
'cms.plugins.file',
'cms.plugins.picture',
'cms.plugins.googlemap',
'cms.plugins.video',
'cms.plugins.twitter',
'cms.plugins.teaser',
'cms.plugins.snippet',
# Internal Apps
'apps.i4p_base',
'apps.member',
'apps.project_sheet',
'apps.partner',
'apps.workgroup',
)
# django-ajax_select
AJAX_LOOKUP_CHANNELS = {
'members' : ('apps.member.lookups', 'UserLookup'),
}
OEMBED_PROVIDERS = {
'YouTube': ('http://www.youtube.com/oembed/',
[r'http://(?:www\.)?youtube\.com/watch\?v=[A-Za-z0-9\-=_]{11}']),
'Vimeo': ('http://vimeo.com/api/oembed.json',
[r'http://(?:www\.)?vimeo\.com/\d+']),
'Dailymotion': ('http://www.dailymotion.com/services/oembed/?wmode=transparent',
[r'http://(?:www\.)?dailymotion\.com/video/\S+']),
'Flickr': ('http://www.flickr.com/services/oembed',
[r'http://(?:www\.)?flickr\.com/photos/\S+?/(?:sets/)?\d+/?']),
}
if DEBUG:
INSTALLED_APPS += (
'debug_toolbar',
)
## Userena
USERENA_WITHOUT_USERNAMES = True
USERENA_MUGSHOT_DEFAULT = 'mm'
USERENA_MUGSHOT_SIZE = 160
USERENA_MUGSHOT_PATH = 'mugshots/'
USERENA_DEFAULT_PRIVACY = 'open'
# localeurl/monther-tongue
PREFIX_DEFAULT_LOCALE = True
LOCALEURL_USE_ACCEPT_LANGUAGE = True
# Userena
ANONYMOUS_USER_ID = -1
AUTH_PROFILE_MODULE = 'member.I4pProfile'
### Nose test runner
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
### Debug-tool-bar
INTERNAL_IPS = ('127.0.0.1', '192.168.0.18')
DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
}
DEBUG_TOOLBAR_PANELS = (
'debug_toolbar.panels.version.VersionDebugPanel',
'debug_toolbar.panels.timer.TimerDebugPanel',
'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
'debug_toolbar.panels.headers.HeaderDebugPanel',
'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
'debug_toolbar.panels.template.TemplateDebugPanel',
# 'debug_toolbar.panels.sql.SQLDebugPanel',
'debug_toolbar.panels.signals.SignalDebugPanel',
'debug_toolbar.panels.logger.LoggingPanel',
)
### Tagging
FORCE_LOWERCASE_TAGS = True
### Mailer
SERVER_EMAIL = '[email protected]'
DEFAULT_FROM_EMAIL = SERVER_EMAIL
# Write emails to console if in development mode
EMAIL_SUBJECT_PREFIX = '[ImaginationForPeople] '
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# else, use SMTP
else:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
### Dajax Ice
DAJAXICE_MEDIA_PREFIX = "js/dajax"
DAJAXICE_XMLHTTPREQUEST_JS_IMPORT = True
DAJAXICE_JSON2_JS_IMPORT = True
DAJAXICE_DEBUG = DEBUG
## LOG IN
LOGIN_REDIRECT_URL = '/'
USERENA_SIGNIN_REDIRECT_URL = '/'
LOGIN_URL = "/member/signin/"
## Ignore dajax ice path
LOCALE_INDEPENDENT_PATHS = (
re.compile('^/js/dajax/.*$'),
re.compile('^/static/.*$'),
re.compile('^/admin/.*$'),
re.compile('^/media/.*$'),
re.compile('^/robots.txt$'),
re.compile('^/sitemap.xml$'),
)
## Flags
COUNTRIES_FLAG_URL = 'images/flags/%(code)s.gif'
### HAYSTACK
HAYSTACK_SITECONF = 'imaginationforpeople.search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh'
HAYSTACK_WHOOSH_PATH = os.path.join(PROJECT_PATH, 'i4p_index')
### STATIC FILES
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static/')
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# Compressor finder
'compressor.finders.CompressorFinder',
)
STATICFILES_DIRS = (
('js', os.path.join(MEDIA_ROOT, 'js')),
('css', os.path.join(MEDIA_ROOT, 'css')),
('css', os.path.join(MEDIA_ROOT, 'compiled_sass')),
('images', os.path.join(MEDIA_ROOT, 'images')),
)
COMPRESS_CSS_FILTERS = (
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.CSSMinFilter'
)
## Grappelli
GRAPPELLI_ADMIN_TITLE = "Imagination For People"
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
### COMPRESOR
COMPRESS_ROOT = STATIC_ROOT
COMPRESS_URL = STATIC_URL
## Rosetta
ROSETTA_WSGI_AUTO_RELOAD = True
## Backcap config
BACKCAP_NOTIFY_WHOLE_STAFF = False
BACKCAP_NOTIFIED_USERS = ['GuillaumeLibersat',
'SimonSarazin',
'AlbanTiberghien']
## TINYMCE
TINYMCE_DEFAULT_CONFIG = {'theme': "advanced",
'relative_urls': False,
'remove_script_host': 0,
'convert_urls': False,
'plugins': "contextmenu",
'width': '90%',
'height': '500px'}
TINYMCE_FILEBROWSER = True
FILEBROWSER_USE_UPLOADIFY = False
## Newsletter
DEFAULT_HEADER_SENDER = "Imagination For People Newsletter <[email protected]>"
## CMS
CMS_TEMPLATES = (
('pages/flatpage.html', _('Black Page')),
('pages/contrib.html', _('Contribution page')),
)
APPEND_SLASH = False