]> git.0d.be Git - panikdb.git/blob - panikdb/settings.py
14cd7d8e8887012ac6773e6b3f634fc54aef7610
[panikdb.git] / panikdb / settings.py
1 # Django settings for panikdb project.
2 # coding: utf-8
3
4 import copy
5 import os
6 from django.conf import global_settings
7
8 DEBUG = True
9 DEBUG_TOOLBAR = True
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     ('Frederic Peters', 'fred@radiopanik.org'),
16 )
17
18 MANAGERS = ADMINS
19
20 DATABASES = {
21     'default': {
22         'ENGINE': 'django.db.backends.sqlite3',
23         'NAME': os.path.join(PROJECT_PATH, 'panikdb.sqlite3'),
24     }
25 }
26
27 # Hosts/domain names that are valid for this site; required if DEBUG is False
28 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
29 ALLOWED_HOSTS = []
30
31 # Local time zone for this installation. Choices can be found here:
32 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
33 # although not all choices may be available on all operating systems.
34 # In a Windows environment this must be set to your system time zone.
35 TIME_ZONE = 'Europe/Brussels'
36
37 # Language code for this installation. All choices can be found here:
38 # http://www.i18nguy.com/unicode/language-identifiers.html
39 LANGUAGE_CODE = 'fr-be'
40
41 SITE_ID = 1
42
43 # If you set this to False, Django will make some optimizations so as not
44 # to load the internationalization machinery.
45 USE_I18N = True
46
47 LOCALE_PATHS = (os.path.join(PROJECT_DIR, 'panikdb', 'locale'),)
48
49 # If you set this to False, Django will not format dates, numbers and
50 # calendars according to the current locale.
51 USE_L10N = True
52
53 # If you set this to False, Django will not use timezone-aware datetimes.
54 USE_TZ = False
55
56 # Absolute filesystem path to the directory that will hold user-uploaded files.
57 # Example: "/var/www/example.com/media/"
58 MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
59
60 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
61 # trailing slash.
62 # Examples: "http://example.com/media/", "http://media.example.com/"
63 MEDIA_URL = '/media/'
64
65 # Absolute path to the directory static files should be collected to.
66 # Don't put anything in this directory yourself; store your static files
67 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
68 # Example: "/var/www/example.com/static/"
69 STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
70
71 # URL prefix for static files.
72 # Example: "http://example.com/static/", "http://static.example.com/"
73 STATIC_URL = '/static/'
74
75 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
76
77 CKEDITOR_UPLOAD_PATH = 'uploads/'
78 CKEDITOR_UPLOAD_PREFIX = '/media/uploads/'
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, 'panikdb', 'static'),
86 )
87
88 # List of finder classes that know how to find static files in
89 # various locations.
90 STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \
91             ['gadjo.finders.XStaticFinder']
92
93 # Make this unique, and don't share it with anybody.
94 SECRET_KEY = '(jwx-1y#d#vps93glikirr&tq_!^_4g+9-qj(jy#l=sllqw(^j'
95
96 TEMPLATES = [
97     {
98         'BACKEND': 'django.template.backends.django.DjangoTemplates',
99         'DIRS': [
100             os.path.join(PROJECT_PATH, 'panikdb', 'templates'),
101         ],
102         'APP_DIRS': True,
103         'OPTIONS': {
104             'context_processors': [
105                 'django.template.context_processors.request',
106                 'django.contrib.auth.context_processors.auth',
107                 'django.template.context_processors.debug',
108                 'django.template.context_processors.i18n',
109                 'django.template.context_processors.media',
110                 'django.template.context_processors.static',
111                 'django.template.context_processors.tz',
112                 'django.contrib.messages.context_processors.messages',
113                 'panikdb.context_processors.internal_ip',
114                 'panikdb.context_processors.site_settings',
115             ],
116             'builtins': [
117                 'combo.public.templatetags.combo',
118             ],
119         },
120     },
121 ]
122
123
124 MIDDLEWARE = (
125     'django.middleware.common.CommonMiddleware',
126     'django.contrib.sessions.middleware.SessionMiddleware',
127     'django.middleware.csrf.CsrfViewMiddleware',
128     'django.contrib.auth.middleware.AuthenticationMiddleware',
129     'django.contrib.messages.middleware.MessageMiddleware',
130     # Uncomment the next line for simple clickjacking protection:
131     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
132 )
133
134 ROOT_URLCONF = 'panikdb.urls'
135
136 # Python dotted path to the WSGI application used by Django's runserver.
137 WSGI_APPLICATION = 'panikdb.wsgi.application'
138
139 INSTALLED_APPS = (
140     'django.contrib.auth',
141     'django.contrib.contenttypes',
142     'django.contrib.sessions',
143     'django.contrib.sites',
144     'django.contrib.messages',
145     'django.contrib.staticfiles',
146     'django.contrib.admin',
147     'registration',
148     'ckeditor',
149     'haystack',
150     'taggit',
151     'emissions',
152     'newsletter',
153     'matos',
154     'nonstop',
155     'panikdb.aa',
156     'panikdb.customtags',
157     'panikdb.stats',
158     'panikdb.poll',
159     'panikdb.wiki',
160     'gadjo',
161     'combo.data',
162     'combo.profile',
163     'combo.public',
164     'combo.manager',
165     'combo.apps.assets',
166     'combo.apps.dashboard',
167     'combo.apps.gallery',
168     'combo.apps.maps',
169     'combo.apps.notifications',
170     'combo.apps.pwa',
171     'combo.apps.search',
172     'sorl.thumbnail',
173     'panikombo',
174     'django_select2',
175     'xstatic.pkg.select2',
176 )
177
178 # A sample logging configuration. The only tangible logging
179 # performed by this configuration is to send an email to
180 # the site admins on every HTTP 500 error when DEBUG=False.
181 # See http://docs.djangoproject.com/en/dev/topics/logging for
182 # more details on how to customize your logging configuration.
183 LOGGING = {
184     'version': 1,
185     'disable_existing_loggers': False,
186     'filters': {
187         'require_debug_false': {
188             '()': 'django.utils.log.RequireDebugFalse'
189         }
190     },
191     'handlers': {
192         'mail_admins': {
193             'level': 'ERROR',
194             'filters': ['require_debug_false'],
195             'class': 'django.utils.log.AdminEmailHandler'
196         }
197     },
198     'loggers': {
199         'django.request': {
200             'handlers': ['mail_admins'],
201             'level': 'ERROR',
202             'propagate': True,
203         },
204     }
205 }
206
207 CKEDITOR_CONFIGS = {
208     'default': {
209         'allowedContent': True,
210         'filebrowserUploadUrl': '/ckeditor/upload/',
211         'filebrowserBrowseUrl': '/ckeditor/browse/',
212         'toolbar_Own': [['Source', 'Format', '-', 'Bold', 'Italic'],
213                         ['NumberedList','BulletedList'],
214                         ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
215                         ['Link', 'Unlink'],
216                         ['Image',],
217                         ['RemoveFormat',]],
218         'toolbar': 'Own',
219     },
220 }
221
222 CKEDITOR_CONFIGS['small'] = copy.copy(CKEDITOR_CONFIGS['default'])
223 CKEDITOR_CONFIGS['small']['height'] = 150
224
225 HAYSTACK_CONNECTIONS = {
226     'default': {
227         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
228         'URL': 'http://127.0.0.1:8985/solr/panik'
229     },
230 }
231
232 CACHES = {
233     'default': {
234         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
235     },
236 }
237
238 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
239
240 AUTH_USER_MODEL = 'aa.User'
241 LOGIN_REDIRECT_URL = '/'
242 WEBSITE_BASE_URL = 'http://www.radiopanik.org/'
243
244 NEWSLETTER_SENDER = 'info@radiopanik.org'
245 NEWSLETTER_DOMAIN = 'radiopanik.org'
246 NEWSLETTER_STYLE = """
247 body { color: #222; text-align: justify; }
248 h2, h3 { font-family: "Reglo"; }
249 h3 { margin-bottom: 0; }
250 h3 + p { margin-top: 0; }
251 p strong { color: black; }
252 h3 strong { text-transform: uppercase; color: blue; }
253 p a { color: black; text-decoration: none; border-bottom: 1px dotted black; }
254 p a:hover { border-bottom: 1px solid black; }
255 """
256
257 RAVEN_CONFIG = None
258
259 from panikombo.misc import COMBO_PUBLIC_TEMPLATES
260
261 COMBO_DASHBOARD_ENABLED = False
262 COMBO_DEFAULT_PUBLIC_TEMPLATE = 'standard'
263 COMBO_MAP_TILE_URLTEMPLATE = ''
264 COMBO_MAP_ATTRIBUTION = ''
265 COMBO_MANAGE_HOME_COLLAPSE_PAGES = False
266
267 AUTO_RENDER_SELECT2_STATICS = False
268
269 PIGE_DOWNLOAD_BASE_URL = 'http://pige.panik/extractor/download.cgi'
270
271 JSON_CELL_TYPES = {}
272 TEMPLATE_VARS = {}
273
274 FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
275 FILE_UPLOAD_PERMISSIONS = 0o644
276
277 HAS_SOMA = False
278 SITE_TITLE = 'PanikDB'
279 COMBO_CELL_ASSET_SLOTS = {}
280
281 local_settings_file = os.environ.get(
282     'PANIKDB_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
283 )
284 if os.path.exists(local_settings_file):
285     exec(open(local_settings_file).read())
286
287
288
289 if DEBUG and DEBUG_TOOLBAR:
290     MIDDLEWARE += (
291         'debug_toolbar.middleware.DebugToolbarMiddleware',
292     )
293     INSTALLED_APPS += (
294         'debug_toolbar',
295     )
296
297 if RAVEN_CONFIG:
298     INSTALLED_APPS += (
299         'raven.contrib.django.raven_compat',
300     )