Search hints/javascript
[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         'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
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 ], key=lambda x: x[0]))
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 # Absolute path to the directory that holds media.
60 # Example: "/home/media/media.lawrence.com/"
61 MEDIA_ROOT = path.join(PROJECT_DIR, '../media')
62 STATIC_ROOT = path.join(PROJECT_DIR, 'static')
63 SEARCH_INDEX = path.join(MEDIA_ROOT, 'search')
64
65 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
66 # trailing slash if there is a path component (optional in other cases).
67 # Examples: "http://media.lawrence.com", "http://example.com/media/"
68 MEDIA_URL = '/media/'
69 STATIC_URL = '/static/'
70
71 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
72 # trailing slash.
73 # Examples: "http://foo.com/media/", "/media/".
74 ADMIN_MEDIA_PREFIX = '/admin-media/'
75
76 # Make this unique, and don't share it with anybody.
77
78 # List of callables that know how to import templates from various sources.
79 TEMPLATE_LOADERS = [
80     'django.template.loaders.filesystem.load_template_source',
81     'django.template.loaders.app_directories.load_template_source',
82 #     'django.template.loaders.eggs.load_template_source',
83 ]
84
85 TEMPLATE_CONTEXT_PROCESSORS = (
86     'django.core.context_processors.auth',
87     'django.core.context_processors.debug',
88     'django.core.context_processors.i18n',
89     'django.core.context_processors.media',
90     'django.core.context_processors.request',
91     'wolnelektury.context_processors.extra_settings',
92 )
93
94 MIDDLEWARE_CLASSES = [
95     'django.middleware.cache.UpdateCacheMiddleware',
96     'django.middleware.common.CommonMiddleware',
97     'django.contrib.sessions.middleware.SessionMiddleware',
98     'django.contrib.auth.middleware.AuthenticationMiddleware',
99     'django.middleware.doc.XViewMiddleware',
100     'pagination.middleware.PaginationMiddleware',
101     'django.middleware.locale.LocaleMiddleware',
102     'piwik.django.middleware.PiwikMiddleware',
103     'maintenancemode.middleware.MaintenanceModeMiddleware',
104     'django.middleware.common.CommonMiddleware',
105     'django.middleware.cache.FetchFromCacheMiddleware',
106 ]
107
108 ROOT_URLCONF = 'wolnelektury.urls'
109
110 TEMPLATE_DIRS = [
111     path.join(PROJECT_DIR, 'templates'),
112 ]
113
114 LOGIN_URL = '/uzytkownicy/zaloguj/'
115
116 LOGIN_REDIRECT_URL = '/'
117
118 INSTALLED_APPS = [
119     # external
120     'django.contrib.auth',
121     'django.contrib.contenttypes',
122     'django.contrib.sessions',
123     'django.contrib.sites',
124     'django.contrib.admin',
125     'django.contrib.admindocs',
126     'pagination',
127     'piston',
128     'piwik.django',
129     'rosetta',
130     'south',
131     'sorl.thumbnail',
132     'djcelery',
133     'djkombu',
134     #    'django_nose',
135
136     # included
137     'compress',
138     'modeltranslation',
139
140     # our
141     'ajaxable',
142     'api',
143     'catalogue',
144     'chunks',
145     'dictionary',
146     'infopages',
147     'lesmianator',
148     'lessons',
149     'newtagging',
150     'opds',
151     'pdcounter',
152     'reporting',
153     'sponsors',
154     'stats',
155     'suggest',
156     'picture',
157     'search',
158 ]
159
160 #CACHE_BACKEND = 'locmem:///?max_entries=3000'
161 #CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
162 CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True
163
164 # CSS and JavaScript file groups
165 COMPRESS_CSS = {
166     'all': {
167         #'source_filenames': ('css/master.css', 'css/jquery.autocomplete.css', 'css/master.plain.css', 'css/facelist_2-0.css',),
168         'source_filenames': [
169             'css/jquery.countdown.css', 
170
171             'css/base.css',
172             'css/header.css',
173             'css/main_page.css',
174             'css/dialogs.css',
175             'css/book_box.css',
176             'css/catalogue.css',
177             'css/sponsors.css',
178             
179             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
180         ],
181         'output_filename': 'css/all.min?.css',
182     },
183     'book': {
184         'source_filenames': ('css/master.book.css',),
185         'output_filename': 'css/book.min?.css',
186     },
187     'simple': {
188         'source_filenames': ('css/simple.css',),
189         'output_filename': 'css/simple.min?.css',
190     },
191 }
192
193 COMPRESS_JS = {
194     'base': {
195         'source_filenames': (
196             'js/jquery.cycle.min.js',
197             'js/jquery.jqmodal.js',
198             'js/jquery.form.js',
199             'js/jquery.countdown.js', 'js/jquery.countdown-pl.js',
200             'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js',
201             'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js',
202             'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js',
203
204             'js/jquery-ui-1.8.16.custom.min.js',
205
206             'js/locale.js',
207             'js/dialogs.js',
208             'js/sponsors.js',
209             'js/pdcounter.js',
210
211             'js/search.js',
212
213             #~ 'js/jquery.autocomplete.js',
214             #~ 'js/jquery.labelify.js', 'js/catalogue.js',
215             ),
216         'output_filename': 'js/base?.min.js',
217     },
218     #~ 'book': {
219         #~ 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',),
220         #~ 'source_filenames': [],
221         #~ 'output_filename': 'js/book?.min.js',
222     #~ },
223     #~ 'book_ie': {
224         #~ 'source_filenames': ('js/ierange-m2.js',),
225         #~ 'source_filenames': [],
226         #~ 'output_filename': 'js/book_ie?.min.js',
227     #~ }
228
229 }
230
231 COMPRESS_VERSION = True
232 COMPRESS_CSS_FILTERS = None
233
234 THUMBNAIL_QUALITY = 95
235 THUMBNAIL_EXTENSION = 'png'
236
237 THUMBNAIL_PROCESSORS = (
238     # Default processors
239     'sorl.thumbnail.processors.colorspace',
240     'sorl.thumbnail.processors.autocrop',
241     'sorl.thumbnail.processors.scale_and_crop',
242     'sorl.thumbnail.processors.filters',
243     # Custom processors
244     'sponsors.processors.add_padding',
245 )
246
247 TRANSLATION_REGISTRY = "wolnelektury.translation"
248
249
250 # seconds until a changes appears in the changes api
251 API_WAIT = 10
252
253 # limit number of filtering tags
254 MAX_TAG_LIST = 6
255
256 NO_BUILD_EPUB = False
257 NO_BUILD_TXT = False
258 NO_BUILD_PDF = False
259 NO_BUILD_MOBI = True
260 NO_SEARCH_INDEX = False
261 SEARCH_INDEX_PARALLEL = False
262
263 ALL_EPUB_ZIP = 'wolnelektury_pl_epub'
264 ALL_PDF_ZIP = 'wolnelektury_pl_pdf'
265 ALL_MOBI_ZIP = 'wolnelektury_pl_mobi'
266
267 CATALOGUE_DEFAULT_LANGUAGE = 'pol'
268
269 PAGINATION_INVALID_PAGE_RAISES_404 = True
270
271 import djcelery
272 djcelery.setup_loader()
273
274 BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
275 BROKER_HOST = "localhost"
276 BROKER_PORT = 5672
277 BROKER_USER = "guest"
278 BROKER_PASSWORD = "guest"
279 BROKER_VHOST = "/"
280
281
282
283 # Load localsettings, if they exist
284 try:
285     from localsettings import *
286 except ImportError:
287     pass
288