cover colors
[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     "allauth.context_processors.allauth",
96     "allauth.account.context_processors.account",
97 )
98
99 MIDDLEWARE_CLASSES = [
100     'django.middleware.cache.UpdateCacheMiddleware',
101     'django.middleware.common.CommonMiddleware',
102     'django.contrib.sessions.middleware.SessionMiddleware',
103     'django.contrib.auth.middleware.AuthenticationMiddleware',
104     'django.middleware.doc.XViewMiddleware',
105     'pagination.middleware.PaginationMiddleware',
106     'django.middleware.locale.LocaleMiddleware',
107     'piwik.django.middleware.PiwikMiddleware',
108     'maintenancemode.middleware.MaintenanceModeMiddleware',
109     'django.middleware.common.CommonMiddleware',
110     'django.middleware.cache.FetchFromCacheMiddleware',
111 ]
112
113 ROOT_URLCONF = 'wolnelektury.urls'
114
115 TEMPLATE_DIRS = [
116     path.join(PROJECT_DIR, 'templates'),
117 ]
118
119
120 AUTHENTICATION_BACKENDS = [
121     'django.contrib.auth.backends.ModelBackend',
122     'allauth.account.auth_backends.AuthenticationBackend',
123 ]
124 EMAIL_CONFIRMATION_DAYS = 2
125 LOGIN_URL = '/uzytkownicy/zaloguj/'
126
127 LOGIN_REDIRECT_URL = '/'
128
129 INSTALLED_APPS = [
130     # external
131     'django.contrib.auth',
132     'django.contrib.contenttypes',
133     'django.contrib.sessions',
134     'django.contrib.sites',
135     'django.contrib.admin',
136     'django.contrib.admindocs',
137     'pagination',
138     'piston',
139     'piwik.django',
140     'rosetta',
141     'south',
142     'sorl.thumbnail',
143     'djcelery',
144     'djkombu',
145     #    'django_nose',
146
147     #allauth stuff
148     'emailconfirmation',
149     'uni_form',
150     'allauth',
151     'allauth.account',
152     'allauth.socialaccount',
153     'allauth.openid',
154     #'allauth.facebook',
155     #'allauth.twitter',
156
157     # included
158     'compress',
159     'modeltranslation',
160
161     # our
162     'ajaxable',
163     'api',
164     'catalogue',
165     'chunks',
166     'dictionary',
167     'infopages',
168     'lesmianator',
169     'lessons',
170     'newtagging',
171     'opds',
172     'pdcounter',
173     'reporting',
174     'sponsors',
175     'stats',
176     'suggest',
177     'picture',
178     'search',
179     'social',
180 ]
181
182 CACHES = {
183     'default': {
184         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
185         'LOCATION': [
186             '127.0.0.1:11211',
187         ]
188     },
189     'permanent': {
190         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
191         'TIMEOUT': 2419200,
192         'LOCATION': [
193             '127.0.0.1:11211',
194         ]
195     },
196     'api': {
197         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
198         'LOCATION': path.join(PROJECT_DIR, 'django_cache/'),
199         'KEY_PREFIX': 'api',
200         'TIMEOUT': 86400,
201     },
202 }
203 CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True
204
205 # CSS and JavaScript file groups
206 COMPRESS_CSS = {
207     'all': {
208         #'source_filenames': ('css/master.css', 'css/jquery.autocomplete.css', 'css/master.plain.css', 'css/facelist_2-0.css',),
209         'source_filenames': [
210             'css/jquery.countdown.css', 
211
212             'css/base.css',
213             'css/cite.css',
214             'css/header.css',
215             'css/main_page.css',
216             'css/dialogs.css',
217             'css/picture_box.css',
218             'css/book_box.css',
219             'css/catalogue.css',
220             'css/sponsors.css',
221             'css/logo.css',
222
223             'css/social/shelf_tags.css',
224             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
225         ],
226         'output_filename': 'css/all.min?.css',
227     },
228     'screen': {
229         'source_filenames': ['css/screen.css'],
230         'output_filename': 'css/screen.min?.css',
231         'extra_context': {
232             'media': 'screen and (min-width: 800px)',
233         },
234     },
235     'ie': {
236         'source_filenames': [
237             'css/ie.css',
238         ],
239         'output_filename': 'css/ie.min?.css',
240     },
241     'book': {
242         'source_filenames': [
243             'css/logo.css',
244             'css/master.book.css',
245         ],
246         'output_filename': 'css/book.min?.css',
247     },
248     'player': {
249         'source_filenames': [
250             'jplayer/jplayer.blue.monday.css', 
251             'css/player.css', 
252         ],
253         'output_filename': 'css/player.min?.css',
254     },
255     'simple': {
256         'source_filenames': ('css/simple.css',),
257         'output_filename': 'css/simple.min?.css',
258     },
259 }
260
261 COMPRESS_JS = {
262     'base': {
263         'source_filenames': (
264             'js/jquery.cycle.min.js',
265             'js/jquery.jqmodal.js',
266             'js/jquery.form.js',
267             'js/jquery.countdown.js', 'js/jquery.countdown-pl.js',
268             'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js',
269             'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js',
270             'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js',
271
272             'js/jquery-ui-1.8.16.custom.min.js',
273
274             'js/locale.js',
275             'js/dialogs.js',
276             'js/sponsors.js',
277             'js/base.js',
278             'js/pdcounter.js',
279
280             'js/search.js',
281             ),
282         'output_filename': 'js/base?.min.js',
283     },
284     'player': {
285         'source_filenames': [
286             'jplayer/jquery.jplayer.min.js', 
287             'jplayer/jplayer.playlist.min.js', 
288             'js/player.js', 
289         ],
290         'output_filename': 'js/player.min?.js',
291     },
292     'book': {
293         'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
294         'output_filename': 'js/book?.min.js',
295     },
296     'book_ie': {
297         'source_filenames': ('js/ierange-m2.js',),
298         'output_filename': 'js/book_ie?.min.js',
299     }
300
301 }
302
303 COMPRESS_VERSION = True
304 COMPRESS_CSS_FILTERS = None
305
306 THUMBNAIL_QUALITY = 95
307
308 TRANSLATION_REGISTRY = "wolnelektury.translation"
309
310
311 # seconds until a changes appears in the changes api
312 API_WAIT = 10
313
314 # limit number of filtering tags
315 MAX_TAG_LIST = 6
316
317 NO_BUILD_EPUB = False
318 NO_BUILD_TXT = False
319 NO_BUILD_PDF = False
320 NO_BUILD_MOBI = True
321 NO_SEARCH_INDEX = False
322
323 ALL_EPUB_ZIP = 'wolnelektury_pl_epub'
324 ALL_PDF_ZIP = 'wolnelektury_pl_pdf'
325 ALL_MOBI_ZIP = 'wolnelektury_pl_mobi'
326
327 CATALOGUE_DEFAULT_LANGUAGE = 'pol'
328 PUBLISH_PLAN_FEED = 'http://redakcja.wolnelektury.pl/documents/track/editor-proofreading/'
329
330 PAGINATION_INVALID_PAGE_RAISES_404 = True
331
332 import djcelery
333 djcelery.setup_loader()
334
335 BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
336 BROKER_HOST = "localhost"
337 BROKER_PORT = 5672
338 BROKER_USER = "guest"
339 BROKER_PASSWORD = "guest"
340 BROKER_VHOST = "/"
341
342 CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
343
344 # Load localsettings, if they exist
345 try:
346     from localsettings import *
347 except ImportError:
348     pass
349