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