]> git.0d.be Git - panikweb.git/blob - panikweb/settings.py
aa7505b4a6d29cd0e38742d4851fda640ba3001b
[panikweb.git] / panikweb / settings.py
1 #!/usr/bin/env python
2
3 import os
4
5 import django.conf.global_settings as DEFAULT_SETTINGS
6
7 DEBUG = True  # Turn off for production
8 DEBUG_TOOLBAR = False
9
10 PROJECT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(__file__)))
11 PROJECT_PATH = os.path.dirname(os.path.dirname(__file__))
12
13 ADMINS = (
14     # ('Your Name', 'your_email@domain.com'),
15 )
16 MANAGERS = ADMINS
17 DEFAULT_FROM_EMAIL = 'info@radiopanik.org'
18
19 LOGIN_REDIRECT_URL = '/'
20
21 DATABASES = {
22     'default': {
23         'ENGINE': 'django.db.backends.sqlite3',
24         'NAME': os.path.join(PROJECT_DIR, 'panikweb.sqlite3'),
25         'USER': '',
26         'PASSWORD': '',
27         'HOST': '',
28         'PORT': '',
29     },
30 }
31
32 ACCOUNT_ACTIVATION_DAYS = 7  # Activation window
33
34 # if django.VERSION[:2] < (1, 6):
35 TEST_RUNNER = 'discover_runner.DiscoverRunner'
36
37 # Local time zone for this installation. Choices can be found here:
38 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
39 # although not all choices may be available on all operating systems.
40 # If running in a Windows environment this must be set to the same as your
41 # system time zone.
42 TIME_ZONE = 'Europe/Brussels'
43
44 # Language code for this installation. All choices can be found here:
45 # http://www.i18nguy.com/unicode/language-identifiers.html
46 LANGUAGE_CODE = 'fr-be'
47
48 LANGUAGES = (
49     ('fr', 'Français'),
50     ('en', 'English'),
51 )
52
53 SITE_ID = 1
54
55 # If you set this to False, Django will make some optimizations so as not
56 # to load the internationalization machinery.
57 USE_I18N = True
58
59 LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikweb', 'locale'),)
60
61 # Absolute filesystem path to the directory that will hold user-uploaded files.
62 # Example: "/home/media/media.lawrence.com/media/"
63 MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
64
65 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
66 # trailing slash.
67 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
68 MEDIA_URL = '/media/'
69
70 # Absolute path to the directory static files should be collected to.
71 # Don't put anything in this directory yourself; store your static files
72 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
73 # Example: "/home/media/media.lawrence.com/static/"
74 STATIC_ROOT = os.path.join(PROJECT_DIR, 'staticroot')
75
76 # URL prefix for static files.
77 # Example: "http://media.lawrence.com/static/"
78 STATIC_URL = '/static/'
79
80 # Additional locations of static files
81 STATICFILES_DIRS = (
82     # Put strings here, like "/home/html/static" or "C:/www/django/static".
83     # Always use forward slashes, even on Windows.
84     # Don't forget to use absolute paths, not relative paths.
85     os.path.join(PROJECT_PATH, 'panikweb', 'static'),
86 )
87
88 # List of finder classes that know how to find static files in
89 # various locations.
90 STATICFILES_FINDERS = (
91     'django.contrib.staticfiles.finders.FileSystemFinder',
92     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
93     'gadjo.finders.XStaticFinder',
94     #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
95 )
96
97
98 # Make this unique, and don't share it with anybody.
99 SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
100
101 MIDDLEWARE = (
102     'django.middleware.cache.UpdateCacheMiddleware',
103     #'django.middleware.gzip.GZipMiddleware',
104     'django.contrib.sessions.middleware.SessionMiddleware',
105     'django.middleware.locale.LocaleMiddleware',
106     'django.middleware.common.CommonMiddleware',
107     'django.middleware.csrf.CsrfViewMiddleware',
108     'django.contrib.auth.middleware.AuthenticationMiddleware',
109     'django.contrib.messages.middleware.MessageMiddleware',
110     #'request.middleware.RequestMiddleware',
111     'panikweb.middleware.StripPiwikCookieMiddleware',
112     'django.middleware.cache.FetchFromCacheMiddleware',
113 )
114
115 TEMPLATES = [
116     {
117         'BACKEND': 'django.template.backends.django.DjangoTemplates',
118         'DIRS': [
119             os.path.join(PROJECT_DIR, 'panikweb', 'templates'),
120         ],
121         'APP_DIRS': True,
122         'OPTIONS': {
123             'context_processors': [
124                 'django.contrib.auth.context_processors.auth',
125                 'django.template.context_processors.debug',
126                 'django.template.context_processors.i18n',
127                 'django.template.context_processors.media',
128                 'django.template.context_processors.request',
129                 'django.template.context_processors.static',
130                 'django.template.context_processors.tz',
131                 'panikweb.context_processors.panikweb',
132             ],
133             'builtins': [
134                 'combo.public.templatetags.combo',
135             ],
136         },
137     },
138 ]
139
140
141 ROOT_URLCONF = 'panikweb.urls'
142
143 TEMPLATE_DIRS = (
144     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
145     # Always use forward slashes, even on Windows.
146     # Don't forget to use absolute paths, not relative paths.
147 )
148
149 INSTALLED_APPS = (
150     'django.contrib.auth',
151     'django.contrib.contenttypes',
152     'django.contrib.sessions',
153     'django.contrib.sites',
154     'django.contrib.messages',
155     'django.contrib.staticfiles',
156     'haystack',
157     'taggit',
158     'gadjo',
159     'panikweb.paniktags',
160     'panikweb.webstats',
161     'sorl.thumbnail',
162     'ckeditor',
163     'emissions',
164     'newsletter',
165     'nonstop',
166     'combo.data',
167     'combo.public',
168     'combo.profile',
169     'combo.apps.assets',
170     'combo.apps.dashboard',
171     'combo.apps.gallery',
172     'combo.apps.maps',
173     'combo.apps.notifications',
174     'combo.apps.pwa',
175     'combo.apps.search',
176     'panikombo',
177     'xstatic.pkg.leaflet',
178     'xstatic.pkg.leaflet_markercluster',
179     'xstatic.pkg.leaflet_gesturehandling',
180 )
181
182 CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
183 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
184
185 HAYSTACK_CONNECTIONS = {
186     'default': {
187         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
188         'URL': 'http://127.0.0.1:8985/solr/panik',
189     },
190 }
191
192 FIBER_TEMPLATE_CHOICES = (('tpl-default.html', 'Default template'),)
193
194 ENABLE_PIWIK = False
195
196 CACHES = {
197     'default': {
198         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
199     },
200 }
201
202 LOGGING = {
203     'version': 1,
204     'disable_existing_loggers': False,
205     'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
206     'handlers': {
207         'mail_admins': {
208             'level': 'ERROR',
209             'filters': ['require_debug_false'],
210             'class': 'django.utils.log.AdminEmailHandler',
211         }
212     },
213     'loggers': {
214         'django.request': {
215             'handlers': ['mail_admins'],
216             'level': 'ERROR',
217             'propagate': True,
218         },
219     },
220 }
221
222 STATSD_CLIENT = 'django_statsd.clients.null'
223
224 RAVEN_CONFIG = None
225
226 ACCESS_LOG_FILENAME = '/var/log/nginx/panikweb-access.log'
227
228 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
229
230 LANGUAGE_COOKIE_NAME = 'panikweb_language'
231
232 TEMPLATE_VARS = {
233     'pwa_display': 'standalone',
234     'theme_color': "#000000",
235 }
236
237 COMBO_DASHBOARD_ENABLED = False
238 COMBO_MAP_TILE_URLTEMPLATE = ''
239 COMBO_MAP_ATTRIBUTION = ''
240 JSON_CELL_TYPES = {}
241 COMBO_CELL_ASSET_SLOTS = {}
242
243 RADIO_NAME = 'Radio Panik'
244 RADIO_LONG_NAME = 'Radio Panik - 105.4 FM'
245 RADIO_META_DESCRIPTION = None
246 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
247 PODCASTS_DEFAULT_IMAGE_PATH = '/static/img/logo-panik-500.png'
248 RADIO_STREAM_URLS = [
249     {
250         'id': 'ogg',
251         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.ogg.m3u',
252         'url': 'https://streaming.domainepublic.net/radiopanik.ogg',
253         'type': 'audio/ogg',
254     },
255     {
256         'id': 'mp3',
257         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.mp3.m3u',
258         'url': 'https://streaming.domainepublic.net/radiopanik.mp3',
259         'type': 'audio/mpeg',
260     },
261 ]
262
263 HOME_EMISSIONS_COUNT = 3
264 HOME_FOCUS_COUNT = 3
265 HOME_NEWSITEMS_COUNT = 3
266 HOME_PODCASTS_COUNT = 3
267 USE_AGENDA_ONLY_FIELD = False
268
269 PROGRAM_PREFIX = 'programme/'
270 EMISSIONS_PREFIX = 'emissions/'
271 NEWSITEMS_PREFIX = 'actus/'
272
273 THUMBNAIL_BACKEND = 'panikweb.utils.ThumbnailBackend'
274
275 COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
276 COMBO_WELCOME_PAGE_PATH = None
277 COMBO_CELL_TEMPLATES = {}
278 CELL_CONDITIONS_ENABLED = False
279
280 local_settings_file = os.environ.get(
281     'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
282 )
283 if os.path.exists(local_settings_file):
284     exec(open(local_settings_file).read())
285
286 if DEBUG and DEBUG_TOOLBAR:
287     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
288     INSTALLED_APPS += ('debug_toolbar',)
289
290 if ENABLE_PIWIK is False:
291     MIDDLEWARE = tuple(x for x in MIDDLEWARE if x != 'panikweb.middleware.StripPiwikCookieMiddleware')
292
293 if STATSD_CLIENT != 'django_statsd.clients.null':
294     MIDDLEWARE = (
295         'django_statsd.middleware.GraphiteRequestTimingMiddleware',
296         'django_statsd.middleware.GraphiteMiddleware',
297     ) + MIDDLEWARE
298     INSTALLED_APPS += ('django_statsd',)
299
300 if RAVEN_CONFIG:
301     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)