]> git.0d.be Git - panikdb.git/blob - panikdb/settings.py
revamp full text search to use postgresql
[panikdb.git] / panikdb / settings.py
1 # Django settings for panikdb project.
2
3 import copy
4 import os
5
6 from django.conf import global_settings
7
8 DEBUG = True
9 DEBUG_TOOLBAR = False
10
11 PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
12 PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
13
14 ADMINS = (('Frederic Peters', 'fred@radiopanik.org'),)
15
16 MANAGERS = ADMINS
17
18 DATABASES = {
19     'default': {
20         'ENGINE': 'django.db.backends.sqlite3',
21         'NAME': os.path.join(PROJECT_PATH, 'panikdb.sqlite3'),
22     }
23 }
24
25 # Hosts/domain names that are valid for this site; required if DEBUG is False
26 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
27 ALLOWED_HOSTS = []
28
29 # Local time zone for this installation. Choices can be found here:
30 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
31 # although not all choices may be available on all operating systems.
32 # In a Windows environment this must be set to your system time zone.
33 TIME_ZONE = 'Europe/Brussels'
34
35 # Language code for this installation. All choices can be found here:
36 # http://www.i18nguy.com/unicode/language-identifiers.html
37 LANGUAGE_CODE = 'fr-be'
38
39 SITE_ID = 1
40
41 # If you set this to False, Django will make some optimizations so as not
42 # to load the internationalization machinery.
43 USE_I18N = True
44
45 LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikdb', 'locale'),)
46
47 # If you set this to False, Django will not format dates, numbers and
48 # calendars according to the current locale.
49 USE_L10N = True
50
51 # If you set this to False, Django will not use timezone-aware datetimes.
52 USE_TZ = False
53
54 # Absolute filesystem path to the directory that will hold user-uploaded files.
55 # Example: "/var/www/example.com/media/"
56 MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
57
58 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
59 # trailing slash.
60 # Examples: "http://example.com/media/", "http://media.example.com/"
61 MEDIA_URL = '/media/'
62
63 # Absolute path to the directory static files should be collected to.
64 # Don't put anything in this directory yourself; store your static files
65 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
66 # Example: "/var/www/example.com/static/"
67 STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
68
69 # URL prefix for static files.
70 # Example: "http://example.com/static/", "http://static.example.com/"
71 STATIC_URL = '/static/'
72
73 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
74
75 CKEDITOR_UPLOAD_PATH = 'uploads/'
76 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
77
78 # Additional locations of static files
79 STATICFILES_DIRS = (
80     # Put strings here, like "/home/html/static" or "C:/www/django/static".
81     # Always use forward slashes, even on Windows.
82     # Don't forget to use absolute paths, not relative paths.
83     os.path.join(PROJECT_PATH, 'panikdb', 'static'),
84 )
85
86 # List of finder classes that know how to find static files in
87 # various locations.
88 STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + ['gadjo.finders.XStaticFinder']
89
90 # Make this unique, and don't share it with anybody.
91 SECRET_KEY = '(jwx-1y#d#vps93glikirr&tq_!^_4g+9-qj(jy#l=sllqw(^j'
92
93 TEMPLATES = [
94     {
95         'BACKEND': 'django.template.backends.django.DjangoTemplates',
96         'DIRS': [
97             os.path.join(PROJECT_PATH, 'panikdb', 'templates'),
98         ],
99         'APP_DIRS': True,
100         'OPTIONS': {
101             'context_processors': [
102                 'django.template.context_processors.request',
103                 'django.contrib.auth.context_processors.auth',
104                 'django.template.context_processors.debug',
105                 'django.template.context_processors.i18n',
106                 'django.template.context_processors.media',
107                 'django.template.context_processors.static',
108                 'django.template.context_processors.tz',
109                 'django.contrib.messages.context_processors.messages',
110                 'panikdb.context_processors.internal_ip',
111                 'panikdb.context_processors.site_settings',
112             ],
113             'builtins': [
114                 'combo.public.templatetags.combo',
115             ],
116         },
117     },
118 ]
119
120
121 MIDDLEWARE = (
122     'django.middleware.common.CommonMiddleware',
123     'django.contrib.sessions.middleware.SessionMiddleware',
124     'django.middleware.csrf.CsrfViewMiddleware',
125     'django.contrib.auth.middleware.AuthenticationMiddleware',
126     'django.contrib.messages.middleware.MessageMiddleware',
127     'panikdb.middleware.StoreRequestMiddleware',
128     # Uncomment the next line for simple clickjacking protection:
129     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
130 )
131
132 ROOT_URLCONF = 'panikdb.urls'
133
134 # Python dotted path to the WSGI application used by Django's runserver.
135 WSGI_APPLICATION = 'panikdb.wsgi.application'
136
137 INSTALLED_APPS = (
138     'django.contrib.auth',
139     'django.contrib.contenttypes',
140     'django.contrib.sessions',
141     'django.contrib.sites',
142     'django.contrib.messages',
143     'django.contrib.staticfiles',
144     'django.contrib.admin',
145     'registration',
146     'ckeditor',
147     'taggit',
148     'emissions',
149     'newsletter',
150     'matos',
151     'wiki',
152     'agendas',
153     'nonstop',
154     'panikdb.aa',
155     'panikdb.customtags',
156     'panikdb.service_messages',
157     'panikdb.oauth',
158     'panikdb.regie',
159     'panikdb.stats',
160     'panikdb.poll',
161     'gadjo',
162     'combo.data',
163     'combo.profile',
164     'combo.public',
165     'combo.manager',
166     'combo.apps.assets',
167     'combo.apps.dashboard',
168     'combo.apps.gallery',
169     'combo.apps.kb',
170     'combo.apps.maps',
171     'combo.apps.notifications',
172     'combo.apps.pwa',
173     'combo.apps.search',
174     'sorl.thumbnail',
175     'panikombo',
176     'xstatic.pkg.select2',
177 )
178
179 # A sample logging configuration. The only tangible logging
180 # performed by this configuration is to send an email to
181 # the site admins on every HTTP 500 error when DEBUG=False.
182 # See http://docs.djangoproject.com/en/dev/topics/logging for
183 # more details on how to customize your logging configuration.
184 LOGGING = {
185     'version': 1,
186     'disable_existing_loggers': False,
187     'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
188     'handlers': {
189         'mail_admins': {
190             'level': 'ERROR',
191             'filters': ['require_debug_false'],
192             'class': 'django.utils.log.AdminEmailHandler',
193         }
194     },
195     'loggers': {
196         'django.request': {
197             'handlers': ['mail_admins'],
198             'level': 'ERROR',
199             'propagate': True,
200         },
201     },
202 }
203
204 CKEDITOR_CONFIGS = {
205     'default': {
206         'extraAllowedContent': 'u i b strong em small',
207         'disallowedContent': 'style; script; *[on*]',
208         'filebrowserUploadUrl': '/ckeditor/upload/',
209         'filebrowserBrowseUrl': '/ckeditor/browse/',
210         'toolbar_Own': [
211             ['Source', 'Format', '-', 'Bold', 'Italic'],
212             ['NumberedList', 'BulletedList'],
213             ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
214             ['Link', 'Unlink'],
215             [
216                 'Image',
217             ],
218             [
219                 'RemoveFormat',
220             ],
221         ],
222         'toolbar': 'Own',
223     },
224 }
225
226 CKEDITOR_CONFIGS['small'] = copy.copy(CKEDITOR_CONFIGS['default'])
227 CKEDITOR_CONFIGS['small']['height'] = 150
228
229 CACHES = {
230     'default': {
231         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
232     },
233 }
234
235 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
236
237 TAGGIT_TAGS_FROM_STRING = 'emissions.utils.custom_parse_tags'
238
239 AUTH_USER_MODEL = 'aa.User'
240 MEMBERSHIP_DEFAULT_AMOUNT = 10
241
242 LOGIN_REDIRECT_URL = '/'
243 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
244
245 NEWSLETTER_SENDER = 'info@radiopanik.org'
246 NEWSLETTER_DOMAIN = 'radiopanik.org'
247 NEWSLETTER_STYLE = """
248 body { color: #222; text-align: justify; }
249 h2, h3 { font-family: "Reglo"; }
250 h3 { margin-bottom: 0; }
251 h3 + p { margin-top: 0; }
252 p strong { color: black; }
253 h3 strong { text-transform: uppercase; color: blue; }
254 p a { color: black; text-decoration: none; border-bottom: 1px dotted black; }
255 p a:hover { border-bottom: 1px solid black; }
256 """
257
258 RAVEN_CONFIG = None
259
260 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
261
262 COMBO_ASSET_SLOTS = {}
263 COMBO_DASHBOARD_ENABLED = False
264 COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
265 COMBO_MAP_TILE_URLTEMPLATE = ''
266 COMBO_MAP_ATTRIBUTION = ''
267 COMBO_MANAGE_HOME_COLLAPSE_PAGES = False
268 COMBO_SEARCH_SERVICES = {}
269 COMBO_PUBLIC_TEMPLATES_ROOT_PAGE = 'modeles'
270 POSTGRESQL_FTS_SEARCH_CONFIG = 'french_unaccent'
271 REQUESTS_TIMEOUT = 28
272
273 AUTO_RENDER_SELECT2_STATICS = False
274
275 PIGE_DOWNLOAD_BASE_URL = 'http://pige.panik/extractor/download.cgi'
276 STATS_VISIT_URL = None
277 REGIE_IPS = ['192.168.17.121', '192.168.17.120', '127.0.0.1']
278
279 JSON_CELL_TYPES = {}
280 TEMPLATE_VARS = {
281     'pwa_display': 'standalone',
282     'theme_color': "#000000",
283 }
284
285 FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
286 FILE_UPLOAD_PERMISSIONS = 0o644
287
288 HAS_SOMA = False
289 HAS_CMS = True
290 HAS_NONSTOP = True
291 HAS_WIKI = True
292 HAS_REGIE = True
293 HAS_PIGE = True
294 HAS_FORUMS = False
295 HAS_NEWSLETTERS = True
296 HAS_RECORDING_BUTTONS = False
297 HAS_MEMBERSHIP_SUPPORT = True
298 USE_EXTERNAL_SOUNDS = False
299 USE_AGENDA_ONLY_FIELD = False
300 HAS_EMISSION_CHATS = False
301
302 SITE_TITLE = 'PanikDB'
303 COMBO_CELL_ASSET_SLOTS = {}
304 COMBO_CELL_TEMPLATES = {}
305 WIKI_SEARCH_BASE_URL = None
306 CELL_CONDITIONS_ENABLED = False
307 FTS_DICTIONARY_CONFIG = 'french'
308
309 local_settings_file = os.environ.get(
310     'PANIKDB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
311 )
312 if os.path.exists(local_settings_file):
313     exec(open(local_settings_file).read())
314
315
316 if DEBUG and DEBUG_TOOLBAR:
317     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
318     INSTALLED_APPS += ('debug_toolbar',)
319
320 if RAVEN_CONFIG:
321     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)