]> git.0d.be Git - panikweb.git/blob - panikweb/settings.py
add custom thumbnail backend to store .webp variants
[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.search',
174     'panikombo',
175     'xstatic.pkg.leaflet',
176     'xstatic.pkg.leaflet_markercluster',
177     'xstatic.pkg.leaflet_gesturehandling',
178 )
179
180 CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
181 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
182
183 HAYSTACK_CONNECTIONS = {
184     'default': {
185         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
186         'URL': 'http://127.0.0.1:8985/solr/panik',
187     },
188 }
189
190 FIBER_TEMPLATE_CHOICES = (('tpl-default.html', 'Default template'),)
191
192 ENABLE_PIWIK = False
193
194 CACHES = {
195     'default': {
196         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
197     },
198 }
199
200 LOGGING = {
201     'version': 1,
202     'disable_existing_loggers': False,
203     'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
204     'handlers': {
205         'mail_admins': {
206             'level': 'ERROR',
207             'filters': ['require_debug_false'],
208             'class': 'django.utils.log.AdminEmailHandler',
209         }
210     },
211     'loggers': {
212         'django.request': {
213             'handlers': ['mail_admins'],
214             'level': 'ERROR',
215             'propagate': True,
216         },
217     },
218 }
219
220 STATSD_CLIENT = 'django_statsd.clients.null'
221
222 RAVEN_CONFIG = None
223
224 ACCESS_LOG_FILENAME = '/var/log/nginx/panikweb-access.log'
225
226 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
227
228 LANGUAGE_COOKIE_NAME = 'panikweb_language'
229
230 TEMPLATE_VARS = {}
231
232 COMBO_DASHBOARD_ENABLED = False
233 COMBO_MAP_TILE_URLTEMPLATE = ''
234 COMBO_MAP_ATTRIBUTION = ''
235 JSON_CELL_TYPES = {}
236 COMBO_CELL_ASSET_SLOTS = {}
237
238 RADIO_NAME = 'Radio Panik'
239 RADIO_LONG_NAME = 'Radio Panik - 105.4 FM'
240 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
241 PODCASTS_DEFAULT_IMAGE_PATH = '/static/img/logo-panik-500.png'
242 RADIO_STREAM_URLS = [
243     {
244         'id': 'ogg',
245         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.ogg.m3u',
246         'url': 'https://streaming.domainepublic.net/radiopanik.ogg',
247         'type': 'audio/ogg',
248     },
249     {
250         'id': 'mp3',
251         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.mp3.m3u',
252         'url': 'https://streaming.domainepublic.net/radiopanik.mp3',
253         'type': 'audio/mpeg',
254     },
255 ]
256
257 HOME_EMISSIONS_COUNT = 3
258 HOME_FOCUS_COUNT = 3
259 HOME_NEWSITEMS_COUNT = 3
260 HOME_PODCASTS_COUNT = 3
261 USE_AGENDA_ONLY_FIELD = False
262
263 PROGRAM_PREFIX = 'programme/'
264 EMISSIONS_PREFIX = 'emissions/'
265 NEWSITEMS_PREFIX = 'actus/'
266
267 THUMBNAIL_BACKEND = 'panikweb.utils.ThumbnailBackend'
268
269 COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
270 COMBO_WELCOME_PAGE_PATH = None
271 COMBO_CELL_TEMPLATES = {}
272
273 local_settings_file = os.environ.get(
274     'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
275 )
276 if os.path.exists(local_settings_file):
277     exec(open(local_settings_file).read())
278
279 if DEBUG and DEBUG_TOOLBAR:
280     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
281     INSTALLED_APPS += ('debug_toolbar',)
282
283 if ENABLE_PIWIK is False:
284     MIDDLEWARE = tuple(x for x in MIDDLEWARE if x != 'panikweb.middleware.StripPiwikCookieMiddleware')
285
286 if STATSD_CLIENT != 'django_statsd.clients.null':
287     MIDDLEWARE = (
288         'django_statsd.middleware.GraphiteRequestTimingMiddleware',
289         'django_statsd.middleware.GraphiteMiddleware',
290     ) + MIDDLEWARE
291     INSTALLED_APPS += ('django_statsd',)
292
293 if RAVEN_CONFIG:
294     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)