forked from thehub/hubplus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.py
421 lines (332 loc) · 13.3 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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# -*- coding: utf-8 -*-
# Django settings for complete pinax project.
# test comment
import os.path
import pinax
from django.utils.translation import ugettext_lazy as _
FORCE_SCRIPT_NAME = ''
PROJECT_THEME = 'plus'
# PROJECT_THEME should be over-ridden in local_settings for an alternative theme,
# and should correspond to one of the directories in theme_settings etc.
PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__))
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# tells Pinax to use the default theme
PINAX_THEME = 'default'
DEBUG = True
TEMPLATE_DEBUG = False # DEBUG
ADMINS = (
('phil jones', 'phil.jones@the-hub.net'),
('tom salfield', 'tom.salfield@the-hub.net'),
)
MANAGERS = ADMINS
# 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 = 'US/Eastern'
#TIME_FORMAT = ''
DATE_FORMAT = _('D, j M Y')
# 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 = 'en'
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
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(os.path.dirname(__file__), "site_media")
# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = '/site_media/'
# 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 = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = '89^ahj730ydh(%+t2$1k3xm!d51=wo$euj@%**kxcuu5n#03b3'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
'dbtemplates.loader.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'apps.django403.middleware.Django403Middleware',
'apps.plus_user.middleware.AnonUserMiddleware',
'django_openid.consumer.SessionConsumer',
'account.middleware.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'pagination.middleware.PaginationMiddleware',
'misc.middleware.SortOrderMiddleware',
'djangodblog.middleware.DBLogMiddleware',
'django.middleware.transaction.TransactionMiddleware',
)
ROOT_URLCONF = 'hubplus.urls' # should be over-ridden in local_settings
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), "templates"),
os.path.join(PINAX_ROOT, "templates", PINAX_THEME),
)
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.request",
"notification.context_processors.notification",
"announcements.context_processors.site_wide_announcements",
"account.context_processors.openid",
"account.context_processors.account",
"misc.context_processors.contact_email",
"misc.context_processors.site_name",
"messages.context_processors.inbox",
"friends_app.context_processors.invitations",
"misc.context_processors.combined_inbox_count",
"apps.plus_lib.context_processors.configs"
)
COMBINED_INBOX_COUNT_SOURCES = (
"messages.context_processors.inbox",
"friends_app.context_processors.invitations",
"notification.context_processors.notification",
)
INSTALLED_APPS = (
# included
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.humanize',
'django.contrib.markup',
'django_evolution',
# external
'notification', # must be first
'django_openid',
'emailconfirmation',
'django_extensions',
'robots',
'dbtemplates',
'friends',
'mailer',
'messages',
'announcements',
'oembed',
'djangodblog',
'pagination',
# 'gravatar',
'threadedcomments',
'wiki',
'swaps',
'timezones',
'app_plugins',
'voting',
'tagging',
'bookmarks',
'blog',
'ajax_validation',
'photologue',
'avatar',
'flag',
'microblogging',
'locations',
'uni_form',
'reversion',
# internal (for now)
'about',
'plus_lib',
'plus_permissions',
'analytics',
'plus_tags',
'plus_comments',
'profiles',
'plus_groups',
'plus_links',
'plus_contacts',
'plus_wiki',
'plus_user',
'plus_resources',
'plus_feed',
'staticfiles',
'account',
'tribes',
'projects',
'misc',
'photos',
'django.contrib.admin',
'haystack',
'django403',
'synced',
)
HAYSTACK_SITECONF = 'search_sites'
HAYSTACK_SEARCH_ENGINE = 'solr'
HAYSTACK_SOLR_URL = 'http://127.0.0.1:8983/solr' # override in local_settings
HAYSTACK_REAL_TIME = False # do we use RealTimeSearchIndex? over-ride in local settings if we want
ABSOLUTE_URL_OVERRIDES = {
"auth.user": lambda o: "/profiles/%s/" % o.username,
}
AUTH_PROFILE_MODULE = 'profiles.Profile'
SITE_NAME_SENTENCE = '' # defaults to site_name in plus_lib/context_processors.py
NOTIFICATION_LANGUAGE_MODULE = 'account.Account'
EMAIL_CONFIRMATION_DAYS = 2
EMAIL_DEBUG = DEBUG
LOGIN_URL = "/account/login"
LOGIN_REDIRECT_URLNAME = "home"
INTERNAL_IPS = (
'127.0.0.1',
)
ugettext = lambda s: s
LANGUAGES = (
('en', u'English'),
('de', u'Deutsch'),
('es', u'Español'),
('fr', u'Français'),
('sv', u'Svenska'),
('pt-br', u'Português brasileiro'),
('he', u'עברית'),
('ar', u'العربية'),
('it', u'Italiano'),
)
# URCHIN_ID = "ua-..."
CACHE_BACKEND = "locmem:///?max_entries=3000"
FEEDUTIL_SUMMARY_LEN = 60*7 # 7 hours
AUTHENTICATION_BACKENDS = ('plus_user.models.HubspaceAuthenticationBackend',)
ACCOUNT_OPEN_SIGNUP = False # signups must be accompanied by the appropriate token
MARKUP_CHOICES = (
('html', 'Plain HMTL'),
('plain', 'Plain Text'),
)
class NullStream(object):
def write(*args, **kw):
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,}
# 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
# 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 = ''
# See if we can over-ride the default GRAVATAR
AVATAR_GRAVATAR_BACKUP = False
AVATAR_DEFAULT_URL = "/site_media/images/member.jpg"
AVATAR_DEFAULT_GROUP_URL = "/site_media/images/group.jpg"
AVATAR_DEFAULT_HUB_URL = "/site_media/images/hub.jpg"
# local_settings.py can be used to override environment-specific settings
# like database and email that differ between development and production.
CONTACT_EMAIL = "world.tech.plus@the-hub.net"
SUPPORT_EMAIL = "world.tech.plus@the-hub.net"
DOMAIN_NAME = "plusdemo.the-hub.net"
SYNC_ENABLED = False
HUBPLUSSVCUID = "hubplus"
HUBPLUSSVCPASS = "SECRET"
SYNCER_HOST = "127.0.0.1"
SYNCER_PORT = 9003
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
SESSION_COOKIE_DOMAIN = ""
HUBSPACE_COMPATIBLE = True # is this running against a HUBSPACE database?
ROOT_URLCONF = 'hubplus.urls'
EMAIL_HOST= 'localhost'
EMAIL_HOST_PASSWORD=''
EMAIL_HOST_USER=''
EMAIL_PORT='25'
EMAIL_USE_TLS=False
# for signing invites
HMAC_KEY = "XXXXXXXXX"
# for profile maps
GOOGLE_MAP_KEY = "ABQIAAAAiA7tLHdzZr8yhGAEbo5FGxS_srkAJTD0j5T3EF3o06M_52NTAhQM2w0ugG9dZdoyPl3s9RqydGrzpQ"
# tells Pinax to serve media through django.views.static.serve.
SERVE_MEDIA = True # DEBUG
PERMISSION_UPLOADS_THROUGH_X_SENDFILE =False # override on a production server
WEBSERVER_MEDIA_ROOT = "" # where the webserver that you've sent an x-sendfile to can find the files
# serve js src files
DEVELOPMENT = False
# a local_settings file can over-ride the above
try:
from local_settings import *
except ImportError:
print "local failed"
pass
# use theme_settings for psn / plus distinctions etc.
theme_config= __import__('theme_settings.%s.theme' % PROJECT_THEME, globals(), locals(), PROJECT_THEME)
# load the theme_settings
for setting in dir(theme_config):
if setting == setting.upper():
locals()[setting] = getattr(theme_config, setting)
# Now setup patches etc.
try:
from apps.plus_user.models import patch_user_class
patch_user_class()
print "import plus_users succeeded"
except ImportError, e:
print "plus user failed :: " + `e`
try:
from apps.plus_groups.models import TgGroup
print "import TgGroup succeeded"
except ImportError, e:
print "import TgGroup failed :: " + `e`
try:
from apps.plus_permissions import patch
except ImportError, e:
print "importing / setting up permissions system failed :: " + `e`
import logging
logging.basicConfig(
level = logging.DEBUG,
format = '%(asctime)s %(levelname)s %(message)s',
)
from threading import Thread
try:
from utils.static_files import get_version_no
JS_VERSION_NO = get_version_no("hubplus_core.js", 'site_media/js')
CSS_VERSION_NO = get_version_no("hubplus_core.css", 'site_media/css')
except ImportError, e:
print `e`
class JsCompile(Thread):
def __init__(self, css=None, js=None):
Thread.__init__(self)
self.CSS_FILES = css and css or []
self.JS_FILES = js and js or []
def run(self):
from utils.static_files import compile, get_version_no
compile(self.JS_FILES, 'site_media/js', 'hubplus_core.js', minified=True)
compile(self.CSS_FILES, 'site_media/css', 'hubplus_core.css')
JS_VERSION_NO = get_version_no("hubplus_core.js", 'site_media/js')
CSS_VERSION_NO = get_version_no("hubplus_core.css", 'site_media/css')
def startThread(self):
Thread.start(self)
try:
from apps.plus_permissions import patch
#do this in a separate thread/process
CSS_FILES = ["site.css", "header.css", "main.css", "serendipity.css", "footer.css", "forms.css", "tabview.css", "overlay.css", "permissions.css", "flickr.css", "list-edit-table.css", "jquery.autocomplete.css", "yui2/editor.css", "yui2/menu.css", "yui2/button.css", "yui2/container.css", "yui2/autocomplete.css", "yui2/slider.css"]
JS_FILES = ["jquery.min.js", "jq.noconflict.js", "ui.core.js", "effects.core.js", "effects.highlight.js", "jquery.bgiframe.min.js", "jquery.autocomplete.min.js", "tools.overlay-1.0.4.min.js", "json2.js", "yui2/build/yahoo-dom-event/yahoo-dom-event.js", "yui2/build/element/element-min.js", "yui2/build/container/container_core-min.js", "yui2/build/menu/menu-min.js", "yui2/build/button/button-min.js", "yui2/build/editor/editor-min.js", "yui2/build/animation/animation-min.js", "yui2/build/logger/logger-min.js", "yui2/build/dragdrop/dragdrop-min.js", "yui2/build/selector/selector-min.js", "yui2/build/tabview/tabview-min.js", "yui2/build/history/history-min.js", "yui2/build/datasource/datasource-min.js", "yui2/build/connection/connection-min.js", "yui2/build/autocomplete/autocomplete-min.js", "editor.js", "ui.accordion.js", "json2.js", "jquery.confirm.js", "jquery.confirm-1.1.js", "hubcms.js", "tab_hist.js", "hubplus.js", "yui2/build/slider/slider-min.js", "plus_resources/replace_file.js", "plus_permissions/views.js", "pinax_libs/comments.js", "plus_links/plus_links.js", "listings.js", "home.js", "plus_microblogging/plus_microblogging.js", "ready.js" ] # , "tinymce/jscripts/tiny_mce/tiny_mce.js"]
import sys
if sys.argv[1] not in ['shell','execfile','evolve', 'flush_cache', 'fix_failed_syncing', 'reindex'] :
# only recompile javascript if we're really running
js_compiler = JsCompile(css=CSS_FILES, js=JS_FILES)
js_compiler.startThread()
except ImportError, e:
print `e`
try:
from utils.static_files import get_version_no
JS_VERSION_NO = get_version_no("hubplus_core.js", 'site_media/js')
CSS_VERSION_NO = get_version_no("hubplus_core.css", 'site_media/css')
except ImportError, e:
print `e`
#from trellis_cache.reactor_in_thread import TrellisThread
#trellis = TrellisThread()