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