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