-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsettings.py
347 lines (279 loc) · 9.42 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
# -*- coding: utf-8 -*-
import os.path
import posixpath
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = []
SERIALIZATION_MODULES = {
'json': 'wadofstuff.django.serializers.json'
}
# tells Pinax to serve media through django.views.static.serve.
SERVE_MEDIA = DEBUG
ADMINS = (
('tor', 'tor@bash.no'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'dev.db.sqlite3'),
}
}
CACHE_MIDDLEWARE_KEY_PREFIX = 'turan'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
},
'file': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': '/var/tmp/django_cache',
},
}
COMPRESS_CACHE_BACKEND = 'default'
COMPRESS_ROOT = os.path.join(PROJECT_ROOT, "static")
COMPRESS_ENABLED = False
# Local time zone for this installation. Choices can be found here:
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
# although not all variations may be possible on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Oslo'
# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'nn'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "site_media")
# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = '/site_media/'
# Absolute path to the directory that holds static files like app media.
# Example: "/home/media/media.lawrence.com/apps/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
# URL that handles the static files like app media.
# Example: "http://media.lawrence.com"
STATIC_URL = '/static/'
# Additional directories which hold static files
STATICFILES_DIRS = (
('turan', os.path.join(PROJECT_ROOT, 'media')),
('bootstrap', os.path.join(PROJECT_ROOT, 'media', 'bootstrap')),
('silksprites', os.path.join(PROJECT_ROOT, 'media', 'silksprites')),
('flot', os.path.join(PROJECT_ROOT, 'media', 'flot')),
('openlayers', os.path.join(PROJECT_ROOT, 'media', 'openlayers')),
)
STATICFILES_EXTRA_MEDIA = (
('turan', os.path.join(PROJECT_ROOT, 'media')),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
# 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 = posixpath.join(MEDIA_URL, "admin/")
# Make this unique, and don't share it with anybody.
SECRET_KEY = '%z3t0zu+99#5(m^w%-+q)m7tc2o9n#p_o%vah-$@7i_#))+0l8'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.gzip.GZipMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.doc.XViewMiddleware',
'pagination.middleware.PaginationMiddleware',
'django_sorting.middleware.SortingMiddleware',
# 'turan.middleware.TuranSentryMarkup',
# 'sentry.client.middleware.SentryResponseErrorIdMiddleware',
# 'turan.middleware.TuranSentry404CatchMiddleware',
'turan.middleware.Http403Middleware',
'django.middleware.transaction.TransactionMiddleware',
)
ROOT_URLCONF = 'urls'
WSGI_APPLICATION = 'wsgi.application'
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, "templates"),
)
DEFAULT_FROM_EMAIL = 'turan@turan.no'
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.request",
"django.contrib.messages.context_processors.messages",
"notification.context_processors.notification",
"announcements.context_processors.site_wide_announcements",
"messages.context_processors.inbox",
"friends_app.context_processors.invitations",
"turansite.context_processors.combined_inbox_count",
)
COMBINED_INBOX_COUNT_SOURCES = (
"messages.context_processors.inbox",
"friends_app.context_processors.invitations",
"notification.context_processors.notification",
)
INSTALLED_APPS = (
# included
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.humanize',
'django.contrib.webdesign',
'microblogging',
'paging',
# external
'notification', # must be first
'django_extensions',
'robots',
'apps.friends',
#'announcements', # this breaks something in django 1.8 i think
'oembed',
'pagination',
'endless_pagination',
'threadedcomments',
'timezones',
'voting',
'tagging',
'ajax_validation',
'avatar',
'crispy_forms',
'django_sorting',
'compressor',
# TUUURAN
'apps.turan',
'piston',
'rosetta',
'debug_toolbar',
# internal (for now)
#
#
'social_auth',
'apps.profiles',
'apps.tag_app',
'apps.api', # turan piston API
# 'groups',
'djcelery',
'wakawaka',
'groupcache',
'phileo',
)
GPX_STORAGE = '/home/turan.no/turansite/site_media/turan'
ABSOLUTE_URL_OVERRIDES = {
"auth.user": lambda o: "/profiles/%s/" % o.username,
}
MARKUP_FILTER_FALLBACK = 'none'
MARKUP_CHOICES = (
('restructuredtext', u'reStructuredText'),
('textile', u'Textile'),
('markdown', u'Markdown'),
('creole', u'Creole'),
)
WIKI_MARKUP_CHOICES = MARKUP_CHOICES
AUTH_PROFILE_MODULE = 'profiles.Profile'
NOTIFICATION_LANGUAGE_MODULE = 'account.Account'
ACCOUNT_OPEN_SIGNUP = True
ACCOUNT_REQUIRED_EMAIL = True
ACCOUNT_EMAIL_VERIFICATION = False
ACCOUNT_USER_DISPLAY = lambda user: user.get_profile().get_name()
AVATAR_DEFAULT_URL = MEDIA_URL + "turan/unknown.png"
AVATAR_GRAVATAR_BACKUP = True
AVATAR_GRAVATAR_DEFAULT = 'http://turan.no/site_media/turan/unknown.png'
EMAIL_CONFIRMATION_DAYS = 2
EMAIL_DEBUG = DEBUG
CONTACT_EMAIL = "turan@turan.no"
SERVER_EMAIL = CONTACT_EMAIL
SITE_NAME = "Turan"
LOGIN_URL = "/account/login/"
LOGIN_REDIRECT_URLNAME = "profile_redirect"
LOGIN_REDIRECT_URL = '/profiles/redirect/'
LANGUAGES = (
('nn', 'Nynorsk'),
('no', u'Bokmål'),
('en', 'English'),
)
URCHIN_ID = "UA-7885298-3"
class NullStream(object):
def write(*args, **kwargs):
pass
writeline = write
writelines = write
RESTRUCTUREDTEXT_FILTER_SETTINGS = {
'cloak_email_addresses': True,
'file_insertion_enabled': False,
'raw_enabled': False,
'warning_stream': NullStream(),
'strip_comments': True,
}
PAGINATION_INVALID_PAGE_RAISES_404 = True
SORTING_INVALID_FIELD_RAISES_404 = True
# if Django is running behind a proxy, we need to do things like use
# HTTP_X_FORWARDED_FOR instead of REMOTE_ADDR. This setting is used
# to inform apps of this fact
BEHIND_PROXY = False
FORCE_LOWERCASE_TAGS = True
WIKI_REQUIRES_LOGIN = True
WAKAWAKA_DEFAULT_INDEX = 'TuranFaq'
SENTRY_LOG_FILE = '/var/log/sentry.log'
# Uncomment this line after signing up for a Yahoo Maps API key at the
# following URL: https://developer.yahoo.com/wsregapp/
# YAHOO_MAPS_API_KEY = ''
import djcelery
djcelery.setup_loader()
BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "turan"
BROKER_PASSWORD = "tur4n"
BROKER_VHOST = "turan"
CELERYD_CONCURRENCY = 2
CELERYD_LOG_FILE = 'celeryd.log'
CELERY_RESULT_BACKEND = "amqp"
CELERY_ALWAYS_EAGER = False
AUTHENTICATION_BACKENDS = (
'social_auth.backends.twitter.TwitterBackend',
'social_auth.backends.facebook.FacebookBackend',
'social_auth.backends.google.GoogleBackend',
'social_auth.backends.contrib.linkedin.LinkedinBackend',
'social_auth.backends.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
)
import random
SOCIAL_AUTH_DEFAULT_USERNAME = lambda: random.choice(['cipo', 'ilpirate', 'elefantino', 'pistelero', 'gruber'])
ENDLESS_PAGINATION_PER_PAGE = 20
ENDLESS_PAGINATION_PREVIOUS_LABEL = '←'
ENDLESS_PAGINATION_NEXT_LABEL = '→'
ENDLESS_PAGINATION_ADD_NOFOLLOW = True
PHILEO_LIKABLE_MODELS = [
"turan.Exercise",
]
# local_settings.py can be used to override environment-specific settings
# like database and email that differ between development and production.
try:
from local_settings import *
except ImportError:
pass