]> git.0d.be Git - panikdb.git/blob - panikdb/settings.py
25d5524468b613f4e62b914baf43e481e9022168
[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.pige',
159     'panikdb.regie',
160     'panikdb.stats',
161     'panikdb.poll',
162     'gadjo',
163     'combo.data',
164     'combo.profile',
165     'combo.public',
166     'combo.manager',
167     'combo.apps.assets',
168     'combo.apps.dashboard',
169     'combo.apps.gallery',
170     'combo.apps.kb',
171     'combo.apps.maps',
172     'combo.apps.notifications',
173     'combo.apps.pwa',
174     'combo.apps.search',
175     'sorl.thumbnail',
176     'panikombo',
177     'xstatic.pkg.select2',
178 )
179
180 # A sample logging configuration. The only tangible logging
181 # performed by this configuration is to send an email to
182 # the site admins on every HTTP 500 error when DEBUG=False.
183 # See http://docs.djangoproject.com/en/dev/topics/logging for
184 # more details on how to customize your logging configuration.
185 LOGGING = {
186     'version': 1,
187     'disable_existing_loggers': False,
188     'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
189     'handlers': {
190         'mail_admins': {
191             'level': 'ERROR',
192             'filters': ['require_debug_false'],
193             'class': 'django.utils.log.AdminEmailHandler',
194         }
195     },
196     'loggers': {
197         'django.request': {
198             'handlers': ['mail_admins'],
199             'level': 'ERROR',
200             'propagate': True,
201         },
202     },
203 }
204
205 CKEDITOR_CONFIGS = {
206     'default': {
207         'extraAllowedContent': 'u i b strong em small',
208         'disallowedContent': 'style; script; *[on*]',
209         'filebrowserUploadUrl': '/ckeditor/upload/',
210         'filebrowserBrowseUrl': '/ckeditor/browse/',
211         'toolbar_Own': [
212             ['Source', 'Format', '-', 'Bold', 'Italic'],
213             ['NumberedList', 'BulletedList'],
214             ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
215             ['Link', 'Unlink'],
216             [
217                 'Image',
218             ],
219             [
220                 'RemoveFormat',
221             ],
222         ],
223         'toolbar': 'Own',
224     },
225 }
226
227 CKEDITOR_CONFIGS['small'] = copy.copy(CKEDITOR_CONFIGS['default'])
228 CKEDITOR_CONFIGS['small']['height'] = 150
229
230 CACHES = {
231     'default': {
232         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
233     },
234 }
235
236 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
237
238 TAGGIT_TAGS_FROM_STRING = 'emissions.utils.custom_parse_tags'
239
240 AUTH_USER_MODEL = 'aa.User'
241 MEMBERSHIP_DEFAULT_AMOUNT = 10
242
243 LOGIN_REDIRECT_URL = '/'
244 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
245
246 NEWSLETTER_SENDER = 'info@radiopanik.org'
247 NEWSLETTER_DOMAIN = 'radiopanik.org'
248 NEWSLETTER_STYLE = """
249 body { color: #222; text-align: justify; }
250 h2, h3 { font-family: "Reglo"; }
251 h3 { margin-bottom: 0; }
252 h3 + p { margin-top: 0; }
253 p strong { color: black; }
254 h3 strong { text-transform: uppercase; color: blue; }
255 p a { color: black; text-decoration: none; border-bottom: 1px dotted black; }
256 p a:hover { border-bottom: 1px solid black; }
257 """
258
259 RAVEN_CONFIG = None
260
261 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
262
263 COMBO_ASSET_SLOTS = {}
264 COMBO_DASHBOARD_ENABLED = False
265 COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
266 COMBO_MAP_TILE_URLTEMPLATE = ''
267 COMBO_MAP_ATTRIBUTION = ''
268 COMBO_MANAGE_HOME_COLLAPSE_PAGES = False
269 COMBO_SEARCH_SERVICES = {}
270 COMBO_PUBLIC_TEMPLATES_ROOT_PAGE = 'modeles'
271 POSTGRESQL_FTS_SEARCH_CONFIG = 'french_unaccent'
272 REQUESTS_TIMEOUT = 28
273
274 AUTO_RENDER_SELECT2_STATICS = False
275
276 STATS_VISIT_URL = None
277 REGIE_IPS = ['192.168.17.121', '192.168.17.120', '127.0.0.1']
278
279 # list of dicts, ex:
280 # PIGES = [
281 #    {
282 #        'slug': 'pige',
283 #        'name': 'Pige',
284 #        'base_dir': '/home/fred/src/panik/sample-pige/srv/pige/',
285 #    },
286 #    ...
287 PIGES = []
288
289 JSON_CELL_TYPES = {}
290 TEMPLATE_VARS = {
291     'pwa_display': 'standalone',
292     'theme_color': "#000000",
293 }
294
295 HAYSTACK_CONNECTIONS = {'default': {}}
296
297 FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
298 FILE_UPLOAD_PERMISSIONS = 0o644
299
300 HAS_SOMA = False
301 HAS_CMS = True
302 HAS_NONSTOP = True
303 HAS_WIKI = True
304 HAS_REGIE = True
305 HAS_PIGE = True
306 HAS_FORUMS = False
307 HAS_NEWSLETTERS = True
308 HAS_RECORDING_BUTTONS = False
309 HAS_MEMBERSHIP_SUPPORT = True
310 USE_EXTERNAL_SOUNDS = False
311 USE_AGENDA_ONLY_FIELD = False
312 HAS_EMISSION_CHATS = False
313
314 SITE_TITLE = 'PanikDB'
315 RADIO_NAME = 'Radio Panik'
316 COMBO_CELL_ASSET_SLOTS = {}
317 COMBO_CELL_TEMPLATES = {}
318 WIKI_SEARCH_BASE_URL = None
319 CELL_CONDITIONS_ENABLED = False
320 FTS_DICTIONARY_CONFIG = 'french'
321
322 local_settings_file = os.environ.get(
323     'PANIKDB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
324 )
325 if os.path.exists(local_settings_file):
326     exec(open(local_settings_file).read())
327
328
329 if DEBUG and DEBUG_TOOLBAR:
330     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
331     INSTALLED_APPS += ('debug_toolbar',)
332
333 if RAVEN_CONFIG:
334     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)