]> git.0d.be Git - panikdb.git/blob - panikdb/settings.py
0ef539de1d3d79080dd2fb124ea65f868aec19dd
[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     'haystack',
148     'taggit',
149     'emissions',
150     'newsletter',
151     'matos',
152     'wiki',
153     'agendas',
154     'nonstop',
155     'panikdb.aa',
156     'panikdb.customtags',
157     'panikdb.service_messages',
158     'panikdb.oauth',
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 HAYSTACK_CONNECTIONS = {
231     'default': {
232         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
233         'URL': 'http://127.0.0.1:8985/solr/panik',
234     },
235 }
236
237 CACHES = {
238     'default': {
239         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
240     },
241 }
242
243 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
244
245 TAGGIT_TAGS_FROM_STRING = 'emissions.utils.custom_parse_tags'
246
247 AUTH_USER_MODEL = 'aa.User'
248 MEMBERSHIP_DEFAULT_AMOUNT = 10
249
250 LOGIN_REDIRECT_URL = '/'
251 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
252
253 NEWSLETTER_SENDER = 'info@radiopanik.org'
254 NEWSLETTER_DOMAIN = 'radiopanik.org'
255 NEWSLETTER_STYLE = """
256 body { color: #222; text-align: justify; }
257 h2, h3 { font-family: "Reglo"; }
258 h3 { margin-bottom: 0; }
259 h3 + p { margin-top: 0; }
260 p strong { color: black; }
261 h3 strong { text-transform: uppercase; color: blue; }
262 p a { color: black; text-decoration: none; border-bottom: 1px dotted black; }
263 p a:hover { border-bottom: 1px solid black; }
264 """
265
266 RAVEN_CONFIG = None
267
268 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
269
270 COMBO_ASSET_SLOTS = {}
271 COMBO_DASHBOARD_ENABLED = False
272 COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
273 COMBO_MAP_TILE_URLTEMPLATE = ''
274 COMBO_MAP_ATTRIBUTION = ''
275 COMBO_MANAGE_HOME_COLLAPSE_PAGES = False
276 COMBO_SEARCH_SERVICES = {}
277 COMBO_PUBLIC_TEMPLATES_ROOT_PAGE = 'modeles'
278 POSTGRESQL_FTS_SEARCH_CONFIG = 'french_unaccent'
279 REQUESTS_TIMEOUT = 28
280
281 AUTO_RENDER_SELECT2_STATICS = False
282
283 PIGE_DOWNLOAD_BASE_URL = 'http://pige.panik/extractor/download.cgi'
284 STATS_VISIT_URL = None
285 REGIE_IPS = ['192.168.17.121', '192.168.17.120', '127.0.0.1']
286
287 JSON_CELL_TYPES = {}
288 TEMPLATE_VARS = {
289     'pwa_display': 'standalone',
290     'theme_color': "#000000",
291 }
292
293 FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
294 FILE_UPLOAD_PERMISSIONS = 0o644
295
296 HAS_SOMA = False
297 HAS_CMS = True
298 HAS_NONSTOP = True
299 HAS_WIKI = True
300 HAS_REGIE = True
301 HAS_PIGE = True
302 HAS_FORUMS = False
303 HAS_NEWSLETTERS = True
304 HAS_RECORDING_BUTTONS = False
305 HAS_MEMBERSHIP_SUPPORT = True
306 USE_EXTERNAL_SOUNDS = False
307 USE_AGENDA_ONLY_FIELD = False
308 HAS_EMISSION_CHATS = False
309
310 SITE_TITLE = 'PanikDB'
311 COMBO_CELL_ASSET_SLOTS = {}
312 COMBO_CELL_TEMPLATES = {}
313 WIKI_SEARCH_BASE_URL = None
314 CELL_CONDITIONS_ENABLED = False
315
316 local_settings_file = os.environ.get(
317     'PANIKDB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
318 )
319 if os.path.exists(local_settings_file):
320     exec(open(local_settings_file).read())
321
322
323 if DEBUG and DEBUG_TOOLBAR:
324     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
325     INSTALLED_APPS += ('debug_toolbar',)
326
327 if RAVEN_CONFIG:
328     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)