]> git.openstreetmap.org Git - osqa.git/blob - settings.py
Improved "convert to question" routine, using the question edit form, and the same...
[osqa.git] / settings.py
1 # encoding:utf-8
2 import os.path
3 import sys
4
5 SITE_ID = 1
6
7 ADMIN_MEDIA_PREFIX = '/admin_media/'
8 SECRET_KEY = '$oo^&_m&qwbib=(_4m_n*zn-d=g#s0he5fx9xonnym#8p6yigm'
9
10 TEMPLATE_LOADERS = [
11     'django.template.loaders.filesystem.load_template_source',
12     'django.template.loaders.app_directories.load_template_source',
13     'forum.modules.template_loader.module_templates_loader',
14     'forum.skins.load_template_source',
15 ]
16
17 MIDDLEWARE_CLASSES = [
18     'django.contrib.sessions.middleware.SessionMiddleware',
19     'django.middleware.common.CommonMiddleware',
20     'forum.middleware.extended_user.ExtendedUser',
21     'forum.middleware.anon_user.ConnectToSessionMessagesMiddleware',
22     'forum.middleware.request_utils.RequestUtils',
23     'forum.middleware.cancel.CancelActionMiddleware',
24     'forum.middleware.admin_messages.AdminMessagesMiddleware',
25     'django.middleware.transaction.TransactionMiddleware',
26 ]
27
28 TEMPLATE_CONTEXT_PROCESSORS = [
29     'django.core.context_processors.request',
30     'forum.context.application_settings',
31     'forum.user_messages.context_processors.user_messages',
32     'django.core.context_processors.auth',
33 ]
34
35 ROOT_URLCONF = 'urls'
36 APPEND_SLASH = True
37
38 TEMPLATE_DIRS = (
39     os.path.join(os.path.dirname(__file__),'forum','skins').replace('\\','/'),
40 )
41
42
43 FILE_UPLOAD_TEMP_DIR = os.path.join(os.path.dirname(__file__), 'tmp').replace('\\','/')
44 FILE_UPLOAD_HANDLERS = ("django.core.files.uploadhandler.MemoryFileUploadHandler",
45  "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
46 DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
47
48 ALLOW_FILE_TYPES = ('.jpg', '.jpeg', '.gif', '.bmp', '.png', '.tiff')
49 ALLOW_MAX_FILE_SIZE = 1024 * 1024
50
51 # User settings
52 from settings_local import *
53
54 try:
55     if len(FORUM_SCRIPT_ALIAS) > 0:
56         APP_URL = '%s/%s' % (APP_URL, FORUM_SCRIPT_ALIAS[:-1])
57 except NameError:
58     pass
59
60 app_url_split = APP_URL.split("://")
61
62 APP_PROTOCOL = app_url_split[0]
63 APP_DOMAIN = app_url_split[1].split('/')[0]
64 APP_BASE_URL = '%s://%s' % (APP_PROTOCOL, APP_DOMAIN)
65
66 FORCE_SCRIPT_NAME = ''
67
68 for path in app_url_split[1].split('/')[1:]:
69     FORCE_SCRIPT_NAME = FORCE_SCRIPT_NAME + '/' + path
70
71 if FORCE_SCRIPT_NAME.endswith('/'):
72     FORCE_SCRIPT_NAME = FORCE_SCRIPT_NAME[:-1]
73
74 from forum import modules
75
76 modules.init_modules_engine(SITE_SRC_ROOT, DISABLED_MODULES)
77
78 [MIDDLEWARE_CLASSES.extend(
79         ["%s.%s" % (m.__name__, mc) for mc in getattr(m, 'MIDDLEWARE_CLASSES', [])]
80                           ) for m in modules.MODULE_LIST]
81
82 [TEMPLATE_LOADERS.extend(
83         ["%s.%s" % (m.__name__, tl) for tl in getattr(m, 'TEMPLATE_LOADERS', [])]
84                           ) for m in modules.MODULE_LIST]
85
86
87 INSTALLED_APPS = [
88     'django.contrib.auth',
89     'django.contrib.contenttypes',
90     'django.contrib.sessions',
91     'django.contrib.sites',
92     'django.contrib.admin',
93     'django.contrib.humanize',
94     'django.contrib.sitemaps',
95     'django.contrib.markup',
96     'forum',
97 ]
98
99 if DEBUG:
100     try:
101         import debug_toolbar
102         MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware')
103         INSTALLED_APPS.append('debug_toolbar')
104     except:
105         pass
106
107 try:
108     import south
109     INSTALLED_APPS.append('south')
110 except:
111     pass
112
113 if not DEBUG:
114     try:
115         import rosetta
116         INSTALLED_APPS.append('rosetta')
117     except:
118         pass
119
120 AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend',]