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