]> git.0d.be Git - panikweb.git/blob - panikweb/settings.py
77bdf60f4c03075646361d3bf2ea50460e01f209
[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 ADMINS = (
13     # ('Your Name', 'your_email@domain.com'),
14 )
15 MANAGERS = ADMINS
16 DEFAULT_FROM_EMAIL = 'info@radiopanik.org'
17
18 LOGIN_REDIRECT_URL = '/'
19
20 DATABASES = {
21     'default': {
22         'ENGINE': 'django.db.backends.sqlite3',
23         'NAME': os.path.join(PROJECT_DIR, 'panikweb.sqlite3'),
24         'USER': '',
25         'PASSWORD': '',
26         'HOST': '',
27         'PORT': '',
28     },
29 }
30
31 ACCOUNT_ACTIVATION_DAYS = 7  # Activation window
32
33 #if django.VERSION[:2] < (1, 6):
34 TEST_RUNNER = 'discover_runner.DiscoverRunner'
35
36 # Local time zone for this installation. Choices can be found here:
37 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
38 # although not all choices may be available on all operating systems.
39 # If running in a Windows environment this must be set to the same as your
40 # system time zone.
41 TIME_ZONE = 'Europe/Brussels'
42
43 # Language code for this installation. All choices can be found here:
44 # http://www.i18nguy.com/unicode/language-identifiers.html
45 LANGUAGE_CODE = 'fr-be'
46
47 LANGUAGES = (
48   ('fr', u'Français'),
49   ('en', u'English'),
50 )
51
52 SITE_ID = 1
53
54 # If you set this to False, Django will make some optimizations so as not
55 # to load the internationalization machinery.
56 USE_I18N = True
57
58 LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikweb', 'locale'),)
59
60 # Absolute filesystem path to the directory that will hold user-uploaded files.
61 # Example: "/home/media/media.lawrence.com/media/"
62 MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
63
64 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
65 # trailing slash.
66 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
67 MEDIA_URL = '/media/'
68
69 # Absolute path to the directory static files should be collected to.
70 # Don't put anything in this directory yourself; store your static files
71 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
72 # Example: "/home/media/media.lawrence.com/static/"
73 STATIC_ROOT = os.path.join(PROJECT_DIR, 'staticroot')
74
75 # URL prefix for static files.
76 # Example: "http://media.lawrence.com/static/"
77 STATIC_URL = '/static/'
78
79 # Additional locations of static files
80 STATICFILES_DIRS = (
81     # Put strings here, like "/home/html/static" or "C:/www/django/static".
82     # Always use forward slashes, even on Windows.
83     # Don't forget to use absolute paths, not relative paths.
84     os.path.join(PROJECT_PATH, 'panikweb', 'static'),
85 )
86
87 # List of finder classes that know how to find static files in
88 # various locations.
89 STATICFILES_FINDERS = (
90     'django.contrib.staticfiles.finders.FileSystemFinder',
91     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
92     'gadjo.finders.XStaticFinder',
93 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
94 )
95
96
97 # Make this unique, and don't share it with anybody.
98 SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
99
100 MIDDLEWARE_CLASSES = (
101     'django.middleware.cache.UpdateCacheMiddleware',
102     #'django.middleware.gzip.GZipMiddleware',
103     'django.contrib.sessions.middleware.SessionMiddleware',
104     'django.middleware.locale.LocaleMiddleware',
105     'django.middleware.common.CommonMiddleware',
106     'django.middleware.csrf.CsrfViewMiddleware',
107     'django.contrib.auth.middleware.AuthenticationMiddleware',
108     'django.contrib.messages.middleware.MessageMiddleware',
109     #'request.middleware.RequestMiddleware',
110     'panikweb.middleware.StripPiwikCookieMiddleware',
111     'django.middleware.cache.FetchFromCacheMiddleware',
112 )
113
114 TEMPLATES = [
115     {
116         'BACKEND': 'django.template.backends.django.DjangoTemplates',
117         'DIRS': [
118             os.path.join(PROJECT_DIR, 'panikweb', 'templates'),
119         ],
120         'APP_DIRS': True,
121         'OPTIONS': {
122             'context_processors': [
123                 'django.contrib.auth.context_processors.auth',
124                 'django.template.context_processors.debug',
125                 'django.template.context_processors.i18n',
126                 'django.template.context_processors.media',
127                 'django.template.context_processors.request',
128                 'django.template.context_processors.static',
129                 'django.template.context_processors.tz',
130                 'panikweb.context_processors.panikweb',
131             ],
132             'builtins': [
133                 'combo.public.templatetags.combo',
134             ],
135         },
136     },
137 ]
138
139
140 ROOT_URLCONF = 'panikweb.urls'
141
142 TEMPLATE_DIRS = (
143     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
144     # Always use forward slashes, even on Windows.
145     # Don't forget to use absolute paths, not relative paths.
146 )
147
148 INSTALLED_APPS = (
149     'django.contrib.auth',
150     'django.contrib.contenttypes',
151     'django.contrib.sessions',
152     'django.contrib.sites',
153     'django.contrib.messages',
154     'django.contrib.staticfiles',
155     'django.contrib.admin',
156     'django.contrib.admindocs',
157     'haystack',
158     'taggit',
159     'gadjo',
160     'panikweb.paniktags',
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.search',
173     'panikombo',
174 )
175
176 CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
177 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
178
179 HAYSTACK_CONNECTIONS = {
180     'default': {
181         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
182         'URL': 'http://127.0.0.1:8985/solr/panik'
183     },
184 }
185
186 FIBER_TEMPLATE_CHOICES = (
187     ('tpl-default.html', 'Default template'),
188 )
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': {
202         'require_debug_false': {
203             '()': 'django.utils.log.RequireDebugFalse'
204         }
205     },
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 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 = 'http://www.radiopanik.org/'
253
254 COMBO_INITIAL_LOGIN_PAGE_PATH = '/'
255 COMBO_WELCOME_PAGE_PATH = None
256
257 local_settings_file = os.environ.get(
258     'PANIKWEB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
259 )
260 if os.path.exists(local_settings_file):
261     exec(open(local_settings_file).read())
262
263 if DEBUG and DEBUG_TOOLBAR:
264     MIDDLEWARE_CLASSES += (
265         'debug_toolbar.middleware.DebugToolbarMiddleware',
266     )
267     INSTALLED_APPS += (
268         'debug_toolbar',
269     )
270
271     if 'template_timings_panel.panels.TemplateTimings.TemplateTimings' in DEBUG_TOOLBAR_PANELS:
272         INSTALLED_APPS += ('template_timings_panel',)
273
274 if ENABLE_PIWIK is False:
275     MIDDLEWARE_CLASSES = tuple([x for x in MIDDLEWARE_CLASSES \
276                                 if x != 'panikweb.middleware.StripPiwikCookieMiddleware'])
277
278 if STATSD_CLIENT != 'django_statsd.clients.null':
279     MIDDLEWARE_CLASSES = (
280             'django_statsd.middleware.GraphiteRequestTimingMiddleware',
281             'django_statsd.middleware.GraphiteMiddleware',
282     ) + MIDDLEWARE_CLASSES
283     INSTALLED_APPS += (
284         'django_statsd',
285     )
286
287 if RAVEN_CONFIG:
288     INSTALLED_APPS += (
289         'raven.contrib.django.raven_compat',
290     )