remove commas from sets' names
[wolnelektury.git] / wolnelektury / settings.py
1 # -*- coding: utf-8 -*-
2 # Django settings for wolnelektury project.
3 from os import path
4
5 PROJECT_DIR = path.abspath(path.dirname(__file__))
6
7 DEBUG = False
8 TEMPLATE_DEBUG = DEBUG
9 MAINTENANCE_MODE = False
10
11 ADMINS = [
12     # ('Your Name', 'your_email@domain.com'),
13 ]
14
15 MANAGERS = ADMINS
16
17 DATABASES = {
18     'default': {
19         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
20         'NAME': path.join(PROJECT_DIR, 'dev.db'), # Or path to database file if using sqlite3.
21         'USER': '',                      # Not used with sqlite3.
22         'PASSWORD': '',                  # Not used with sqlite3.
23         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
24     }
25 }
26
27
28 # Local time zone for this installation. Choices can be found here:
29 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
30 # although not all choices may be available on all operating systems.
31 # If running in a Windows environment this must be set to the same as your
32 # system time zone.
33 TIME_ZONE = 'Europe/Warsaw'
34
35 # Language code for this installation. All choices can be found here:
36 # http://www.i18nguy.com/unicode/language-identifiers.html
37 LANGUAGE_CODE = 'pl'
38
39 gettext = lambda s: s
40
41 LANGUAGES = tuple(sorted([
42     ('pl', u'polski'),
43     ('de', u'Deutsch'),
44     ('en', u'English'),
45     ('lt', u'lietuvių'),
46     ('fr', u'français'),
47     ('ru', u'русский'),
48     ('es', u'español'),
49     ('uk', u'українська'),
50     ('jp', u'日本語'),
51     ('it', u'italiano'),
52 ], key=lambda x: x[0]))
53
54
55 SITE_ID = 1
56
57 # If you set this to False, Django will make some optimizations so as not
58 # to load the internationalization machinery.
59 USE_I18N = True
60
61 # Absolute path to the directory that holds media.
62 # Example: "/home/media/media.lawrence.com/"
63 MEDIA_ROOT = path.join(PROJECT_DIR, '../media/')
64 STATIC_ROOT = path.join(PROJECT_DIR, 'static/')
65 SEARCH_INDEX = path.join(MEDIA_ROOT, 'search/')
66
67 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
68 # trailing slash if there is a path component (optional in other cases).
69 # Examples: "http://media.lawrence.com", "http://example.com/media/"
70 MEDIA_URL = '/media/'
71 STATIC_URL = '/static/'
72
73 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
74 # trailing slash.
75 # Examples: "http://foo.com/media/", "/media/".
76 ADMIN_MEDIA_PREFIX = '/admin-media/'
77
78 # Make this unique, and don't share it with anybody.
79
80 # List of callables that know how to import templates from various sources.
81 TEMPLATE_LOADERS = [
82     'django.template.loaders.filesystem.Loader',
83     'django.template.loaders.app_directories.Loader',
84 #     'django.template.loaders.eggs.Loader',
85 ]
86
87 TEMPLATE_CONTEXT_PROCESSORS = (
88     'django.contrib.auth.context_processors.auth',
89     'django.core.context_processors.debug',
90     'django.core.context_processors.i18n',
91     'django.core.context_processors.media',
92     'django.core.context_processors.request',
93     'wolnelektury.context_processors.extra_settings',
94     'search.context_processors.search_form',
95 )
96
97 MIDDLEWARE_CLASSES = [
98     'django.middleware.cache.UpdateCacheMiddleware',
99     'django.middleware.common.CommonMiddleware',
100     'django.contrib.sessions.middleware.SessionMiddleware',
101     'django.contrib.auth.middleware.AuthenticationMiddleware',
102     'django.middleware.doc.XViewMiddleware',
103     'pagination.middleware.PaginationMiddleware',
104     'django.middleware.locale.LocaleMiddleware',
105     'piwik.django.middleware.PiwikMiddleware',
106     'maintenancemode.middleware.MaintenanceModeMiddleware',
107     'django.middleware.common.CommonMiddleware',
108     'django.middleware.cache.FetchFromCacheMiddleware',
109 ]
110
111 ROOT_URLCONF = 'wolnelektury.urls'
112
113 TEMPLATE_DIRS = [
114     path.join(PROJECT_DIR, 'templates'),
115 ]
116
117 LOGIN_URL = '/uzytkownicy/zaloguj/'
118
119 LOGIN_REDIRECT_URL = '/'
120
121 INSTALLED_APPS = [
122     # external
123     'django.contrib.auth',
124     'django.contrib.contenttypes',
125     'django.contrib.sessions',
126     'django.contrib.sites',
127     'django.contrib.admin',
128     'django.contrib.admindocs',
129     'pagination',
130     'piston',
131     'piwik.django',
132     'rosetta',
133     'south',
134     'sorl.thumbnail',
135     'djcelery',
136     'djkombu',
137     #    'django_nose',
138
139     # included
140     'compress',
141     'modeltranslation',
142
143     # our
144     'ajaxable',
145     'api',
146     'catalogue',
147     'chunks',
148     'dictionary',
149     'infopages',
150     'lesmianator',
151     'lessons',
152     'newtagging',
153     'opds',
154     'pdcounter',
155     'reporting',
156     'sponsors',
157     'stats',
158     'suggest',
159     'picture',
160     'search',
161     'social',
162 ]
163
164 CACHES = {
165     'default': {
166         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
167         'LOCATION': [
168             '127.0.0.1:11211',
169         ]
170     },
171     'permanent': {
172         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
173         'TIMEOUT': 2419200,
174         'LOCATION': [
175             '127.0.0.1:11211',
176         ]
177     },
178     'api': {
179         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
180         'LOCATION': path.join(PROJECT_DIR, 'django_cache/'),
181         'KEY_PREFIX': 'api',
182         'TIMEOUT': 86400,
183     },
184 }
185 CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True
186
187 # CSS and JavaScript file groups
188 COMPRESS_CSS = {
189     'all': {
190         #'source_filenames': ('css/master.css', 'css/jquery.autocomplete.css', 'css/master.plain.css', 'css/facelist_2-0.css',),
191         'source_filenames': [
192             'css/jquery.countdown.css', 
193
194             'css/base.css',
195             'css/cite.css',
196             'css/header.css',
197             'css/main_page.css',
198             'css/dialogs.css',
199             'css/picture_box.css',
200             'css/book_box.css',
201             'css/catalogue.css',
202             'css/sponsors.css',
203             'css/logo.css',
204
205             'css/social/shelf_tags.css',
206             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
207         ],
208         'output_filename': 'css/all.min?.css',
209     },
210     'screen': {
211         'source_filenames': ['css/screen.css'],
212         'output_filename': ['css/screen.min?.css'],
213         'extra_context': {
214             'media': 'screen and (min-width: 800px)',
215         },
216     },
217     'ie': {
218         'source_filenames': [
219             'css/ie.css',
220         ],
221         'output_filename': 'css/ie.min?.css',
222     },
223     'book': {
224         'source_filenames': [
225             'css/logo.css',
226             'css/master.book.css',
227         ],
228         'output_filename': 'css/book.min?.css',
229     },
230     'player': {
231         'source_filenames': [
232             'jplayer/jplayer.blue.monday.css', 
233             'css/player.css', 
234         ],
235         'output_filename': 'css/player.min?.css',
236     },
237     'simple': {
238         'source_filenames': ('css/simple.css',),
239         'output_filename': 'css/simple.min?.css',
240     },
241 }
242
243 COMPRESS_JS = {
244     'base': {
245         'source_filenames': (
246             'js/jquery.cycle.min.js',
247             'js/jquery.jqmodal.js',
248             'js/jquery.form.js',
249             'js/jquery.countdown.js', 'js/jquery.countdown-pl.js',
250             'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js',
251             'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js',
252             'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js',
253
254             'js/jquery-ui-1.8.16.custom.min.js',
255
256             'js/locale.js',
257             'js/dialogs.js',
258             'js/sponsors.js',
259             'js/base.js',
260             'js/pdcounter.js',
261
262             'js/search.js',
263             ),
264         'output_filename': 'js/base?.min.js',
265     },
266     'player': {
267         'source_filenames': [
268             'jplayer/jquery.jplayer.min.js', 
269             'jplayer/jplayer.playlist.min.js', 
270             'js/player.js', 
271         ],
272         'output_filename': 'js/player.min?.js',
273     },
274     'book': {
275         'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
276         'output_filename': 'js/book?.min.js',
277     },
278     'book_ie': {
279         'source_filenames': ('js/ierange-m2.js',),
280         'output_filename': 'js/book_ie?.min.js',
281     }
282
283 }
284
285 COMPRESS_VERSION = True
286 COMPRESS_CSS_FILTERS = None
287
288 THUMBNAIL_QUALITY = 95
289 THUMBNAIL_EXTENSION = 'png'
290
291 THUMBNAIL_PROCESSORS = (
292     # Default processors
293     'sorl.thumbnail.processors.colorspace',
294     'sorl.thumbnail.processors.autocrop',
295     'sorl.thumbnail.processors.scale_and_crop',
296     'sorl.thumbnail.processors.filters',
297     # Custom processors
298     'sponsors.processors.add_padding',
299 )
300
301 TRANSLATION_REGISTRY = "wolnelektury.translation"
302
303
304 # seconds until a changes appears in the changes api
305 API_WAIT = 10
306
307 # limit number of filtering tags
308 MAX_TAG_LIST = 6
309
310 NO_BUILD_EPUB = False
311 NO_BUILD_TXT = False
312 NO_BUILD_PDF = False
313 NO_BUILD_MOBI = True
314 NO_SEARCH_INDEX = False
315
316 ALL_EPUB_ZIP = 'wolnelektury_pl_epub'
317 ALL_PDF_ZIP = 'wolnelektury_pl_pdf'
318 ALL_MOBI_ZIP = 'wolnelektury_pl_mobi'
319
320 CATALOGUE_DEFAULT_LANGUAGE = 'pol'
321 PUBLISH_PLAN_FEED = 'http://redakcja.wolnelektury.pl/documents/track/editor-proofreading/'
322
323 PAGINATION_INVALID_PAGE_RAISES_404 = True
324
325 import djcelery
326 djcelery.setup_loader()
327
328 BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
329 BROKER_HOST = "localhost"
330 BROKER_PORT = 5672
331 BROKER_USER = "guest"
332 BROKER_PASSWORD = "guest"
333 BROKER_VHOST = "/"
334
335 CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
336
337 # Load localsettings, if they exist
338 try:
339     from localsettings import *
340 except ImportError:
341     pass
342