]> git.0d.be Git - panikweb.git/blob - panikweb/settings.py
add agenda only setting value
[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 DEBUG_TOOLBAR_PANELS = (
227     'debug_toolbar.panels.version.VersionDebugPanel',
228     'debug_toolbar.panels.timer.TimerDebugPanel',
229     'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
230     'debug_toolbar.panels.headers.HeaderDebugPanel',
231     'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
232     'debug_toolbar.panels.sql.SQLDebugPanel',
233     'debug_toolbar.panels.template.TemplateDebugPanel',
234     'debug_toolbar.panels.signals.SignalDebugPanel',
235     'debug_toolbar.panels.logger.LoggingPanel',
236 )
237
238 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
239
240 LANGUAGE_COOKIE_NAME = 'panikweb_language'
241
242 TEMPLATE_VARS = {}
243
244 COMBO_DASHBOARD_ENABLED = False
245 COMBO_MAP_TILE_URLTEMPLATE = ''
246 COMBO_MAP_ATTRIBUTION = ''
247 JSON_CELL_TYPES = {}
248 COMBO_CELL_ASSET_SLOTS = {}
249
250 RADIO_NAME = 'Radio Panik'
251 RADIO_LONG_NAME = 'Radio Panik - 105.4 FM'
252 WEBSITE_BASE_URL = 'https://www.radiopanik.org/'
253 PODCASTS_DEFAULT_IMAGE_PATH = '/static/img/logo-panik-500.png'
254 RADIO_STREAM_URLS = [
255     {
256         'id': 'ogg',
257         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.ogg.m3u',
258         'url': 'https://streaming.domainepublic.net/radiopanik.ogg',
259         'type': 'audio/ogg',
260     },
261     {
262         'id': 'mp3',
263         'm3u_url': 'https://streaming.domainepublic.net/radiopanik.mp3.m3u',
264         'url': 'https://streaming.domainepublic.net/radiopanik.mp3',
265         'type': 'audio/mpeg',
266     },
267 ]
268
269 HOME_EMISSIONS_COUNT = 3
270 HOME_FOCUS_COUNT = 3
271 HOME_NEWSITEMS_COUNT = 3
272 HOME_PODCASTS_COUNT = 3
273 USE_AGENDA_ONLY_FIELD = False
274
275 PROGRAM_PREFIX = 'programme/'
276 EMISSIONS_PREFIX = 'emissions/'
277 NEWSITEMS_PREFIX = 'actus/'
278
279
280 COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
281 COMBO_WELCOME_PAGE_PATH = None
282 COMBO_CELL_TEMPLATES = {}
283
284 local_settings_file = os.environ.get(
285     'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
286 )
287 if os.path.exists(local_settings_file):
288     exec(open(local_settings_file).read())
289
290 if DEBUG and DEBUG_TOOLBAR:
291     MIDDLEWARE += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
292     INSTALLED_APPS += ('debug_toolbar',)
293
294     if 'template_timings_panel.panels.TemplateTimings.TemplateTimings' in DEBUG_TOOLBAR_PANELS:
295         INSTALLED_APPS += ('template_timings_panel',)
296
297 if ENABLE_PIWIK is False:
298     MIDDLEWARE = tuple(x for x in MIDDLEWARE if x != 'panikweb.middleware.StripPiwikCookieMiddleware')
299
300 if STATSD_CLIENT != 'django_statsd.clients.null':
301     MIDDLEWARE = (
302         'django_statsd.middleware.GraphiteRequestTimingMiddleware',
303         'django_statsd.middleware.GraphiteMiddleware',
304     ) + MIDDLEWARE
305     INSTALLED_APPS += ('django_statsd',)
306
307 if RAVEN_CONFIG:
308     INSTALLED_APPS += ('raven.contrib.django.raven_compat',)