]> git.0d.be Git - panikweb.git/blob - panikweb/settings.py
update for django 1.11
[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 )
85
86 # List of finder classes that know how to find static files in
87 # various locations.
88 STATICFILES_FINDERS = (
89     'django.contrib.staticfiles.finders.FileSystemFinder',
90     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
91     'compressor.finders.CompressorFinder',
92 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
93 )
94
95 # Make this unique, and don't share it with anybody.
96 SECRET_KEY = '3qm&amp;@6264-=st16)7_xa*ds+31e0mqqs@+*!ud7gzt$tq!b^qn'
97
98 MIDDLEWARE_CLASSES = (
99     'django.middleware.cache.UpdateCacheMiddleware',
100     #'django.middleware.gzip.GZipMiddleware',
101     'django.contrib.sessions.middleware.SessionMiddleware',
102     'django.middleware.locale.LocaleMiddleware',
103     'django.middleware.common.CommonMiddleware',
104     'django.middleware.csrf.CsrfViewMiddleware',
105     'django.contrib.auth.middleware.AuthenticationMiddleware',
106     'django.contrib.messages.middleware.MessageMiddleware',
107     #'request.middleware.RequestMiddleware',
108     'panikweb.middleware.StripPiwikCookieMiddleware',
109     'django.middleware.cache.FetchFromCacheMiddleware',
110 )
111
112 TEMPLATES = [
113     {
114         'BACKEND': 'django.template.backends.django.DjangoTemplates',
115         'DIRS': [
116             os.path.join(PROJECT_DIR, 'panikweb_templates'),
117         ],
118         'APP_DIRS': True,
119         'OPTIONS': {
120             'context_processors': [
121                 'django.contrib.auth.context_processors.auth',
122                 'django.template.context_processors.debug',
123                 'django.template.context_processors.i18n',
124                 'django.template.context_processors.media',
125                 'django.template.context_processors.request',
126                 'django.template.context_processors.static',
127                 'django.template.context_processors.tz',
128                 'panikweb.context_processors.site_url',
129             ],
130         },
131     },
132 ]
133
134
135 ROOT_URLCONF = 'panikweb.urls'
136
137 TEMPLATE_DIRS = (
138     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
139     # Always use forward slashes, even on Windows.
140     # Don't forget to use absolute paths, not relative paths.
141 )
142
143 INSTALLED_APPS = (
144     'django.contrib.auth',
145     'django.contrib.contenttypes',
146     'django.contrib.sessions',
147     'django.contrib.sites',
148     'django.contrib.messages',
149     'django.contrib.staticfiles',
150     'django.contrib.admin',
151     'django.contrib.admindocs',
152     'haystack',
153     'taggit',
154     'panikweb_templates',
155     'panikweb.paniktags',
156     'compressor',
157     'sorl.thumbnail',
158     'ckeditor',
159     'emissions',
160     'newsletter',
161     'nonstop',
162     'combo.data',
163     'combo.public',
164     'combo.profile',
165     'combo.apps.dashboard',
166     'combo.apps.search',
167     'panikombo',
168     'gallery',
169 )
170
171 CKEDITOR_UPLOAD_PATH = os.path.join(MEDIA_ROOT, 'uploads')
172 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
173
174 HAYSTACK_CONNECTIONS = {
175     'default': {
176         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
177         'URL': 'http://127.0.0.1:8985/solr/panik'
178     },
179 }
180
181 FIBER_TEMPLATE_CHOICES = (
182     ('tpl-default.html', 'Default template'),
183 )
184
185 ENABLE_PIWIK = False
186
187 CACHES = {
188     'default': {
189         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
190     },
191 }
192
193 LOGGING = {
194     'version': 1,
195     'disable_existing_loggers': False,
196     'filters': {
197         'require_debug_false': {
198             '()': 'django.utils.log.RequireDebugFalse'
199         }
200     },
201     'handlers': {
202         'mail_admins': {
203             'level': 'ERROR',
204             'filters': ['require_debug_false'],
205             'class': 'django.utils.log.AdminEmailHandler'
206         }
207     },
208     'loggers': {
209         'django.request': {
210             'handlers': ['mail_admins'],
211             'level': 'ERROR',
212             'propagate': True,
213         },
214     }
215 }
216
217 STATSD_CLIENT = 'django_statsd.clients.null'
218
219 RAVEN_CONFIG = None
220
221 DEBUG_TOOLBAR_PANELS = (
222     'debug_toolbar.panels.version.VersionDebugPanel',
223     'debug_toolbar.panels.timer.TimerDebugPanel',
224     'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
225     'debug_toolbar.panels.headers.HeaderDebugPanel',
226     'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
227     'debug_toolbar.panels.sql.SQLDebugPanel',
228     'debug_toolbar.panels.template.TemplateDebugPanel',
229     'debug_toolbar.panels.signals.SignalDebugPanel',
230     'debug_toolbar.panels.logger.LoggingPanel',
231 )
232
233 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
234
235 LANGUAGE_COOKIE_NAME = 'panikweb_language'
236
237 TEMPLATE_VARS = {}
238
239 COMBO_DASHBOARD_ENABLED = False
240
241 WEBSITE_BASE_URL = 'http://www.radiopanik.org/'
242
243 try:
244     from local_settings import *
245 except ImportError, e:
246     pass
247
248 if DEBUG and DEBUG_TOOLBAR:
249     MIDDLEWARE_CLASSES += (
250         'debug_toolbar.middleware.DebugToolbarMiddleware',
251     )
252     INSTALLED_APPS += (
253         'debug_toolbar',
254     )
255
256     if 'template_timings_panel.panels.TemplateTimings.TemplateTimings' in DEBUG_TOOLBAR_PANELS:
257         INSTALLED_APPS += ('template_timings_panel',)
258
259 if ENABLE_PIWIK is False:
260     MIDDLEWARE_CLASSES = tuple([x for x in MIDDLEWARE_CLASSES \
261                                 if x != 'panikweb.middleware.StripPiwikCookieMiddleware'])
262
263 if STATSD_CLIENT != 'django_statsd.clients.null':
264     MIDDLEWARE_CLASSES = (
265             'django_statsd.middleware.GraphiteRequestTimingMiddleware',
266             'django_statsd.middleware.GraphiteMiddleware',
267     ) + MIDDLEWARE_CLASSES
268     INSTALLED_APPS += (
269         'django_statsd',
270     )
271
272 if RAVEN_CONFIG:
273     INSTALLED_APPS += (
274         'raven.contrib.django.raven_compat',
275     )