b8b7828399ee2c2bc372a3b9846eadaea76e3cfa
[wolnelektury.git] / src / wolnelektury / settings / static.py
1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 from os import path
6 from .paths import VAR_DIR
7
8 # Absolute path to the directory that holds media.
9 # Example: "/home/media/media.lawrence.com/"
10 MEDIA_ROOT = path.join(VAR_DIR, 'media/')
11 STATIC_ROOT = path.join(VAR_DIR, 'static/')
12 SEARCH_INDEX = path.join(VAR_DIR, 'search_index/')
13
14 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
15 # trailing slash if there is a path component (optional in other cases).
16 # Examples: "http://media.lawrence.com", "http://example.com/media/"
17 MEDIA_URL = '/media/'
18 STATIC_URL = '/static/'
19
20 IMAGE_DIR = 'book/pictures/'
21
22 # CSS and JavaScript file groups
23
24 PIPELINE = {
25     'STYLESHEETS': {
26         'main': {
27             # styles both for mobile and for big screen
28             'source_filenames': [
29                 'css/jquery.countdown.css',
30                 'jplayer/jplayer.blue.monday.css',
31
32                 'sponsors/css/sponsors.css',
33
34                 'css/annoy.css',
35
36                 'css/ui-lightness/jquery-ui-1.8.16.custom.css',
37
38                 'css/tlite.css',
39
40                 'scss/main.scss',
41             ],
42             'output_filename': 'css/compressed/main.css',
43         },
44         'book': {
45             'source_filenames': [
46                 'css/master.book.css',
47             ],
48             'output_filename': 'css/compressed/book.css',
49         },
50         'book_text': {
51             'source_filenames': [
52                 'scss/book_text.scss',
53                 'css/new.book.css',
54                 'css/annoy.css',
55
56                 'css/master.picture.css',
57             ],
58             'output_filename': 'css/compressed/book_text.css',
59         },
60         'picture': {
61             'source_filenames': [
62                 'css/master.book.css',
63                 'css/master.picture.css',
64             ],
65             'output_filename': 'css/compressed/picture.css',
66         },
67         'player': {
68             'source_filenames': [
69                 'jplayer/jplayer.blue.monday.css',
70                 'player/player.css',
71             ],
72             'output_filename': 'css/compressed/player.css',
73         },
74         'simple': {
75             'source_filenames': ('css/simple.css',),
76             'output_filename': 'css/compressed/simple.css',
77         },
78         'widget': {
79             'source_filenames': ('scss/widget.scss',),
80             'output_filename': 'css/compressed/widget.css',
81         },
82     },
83     'JAVASCRIPT': {
84         'base': {
85             'source_filenames': (
86                 'js/contrib/jquery.cycle2.min.js',
87                 'js/contrib/jquery.jqmodal.js',
88                 'js/contrib/jquery.form.js',
89                 'js/contrib/jquery.paging.min.js',
90                 'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js',
91                 'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js',
92                 'js/contrib/jquery.countdown-es.js', 'js/contrib/jquery.countdown-lt.js',
93                 'js/contrib/jquery.countdown-ru.js', 'js/contrib/jquery.countdown-fr.js',
94                 'js/contrib/jquery.shorten.js',
95
96                 'js/contrib/jquery-ui-1.8.16.custom.min.js',
97
98                 'js/contrib/tlite.min.js',
99
100                 'jplayer/jquery.jplayer.min.js',
101                 'jplayer/jplayer.playlist.min.js',
102                 'player/player.js',
103
104                 'js/locale.js',
105                 'js/dialogs.js',
106                 'js/base.js',
107                 'pdcounter/pdcounter.js',
108                 'sponsors/js/sponsors.js',
109                 'player/openplayer.js',
110                 'js/search.js',
111                 'funding/funding.js',
112                 'club/form.js',
113
114                 'js/annoy.js',
115                 ),
116             'output_filename': 'js/base.min.js',
117         },
118         'player': {
119             'source_filenames': [
120                 'jplayer/jquery.jplayer.min.js',
121                 'jplayer/jplayer.playlist.min.js',
122                 'player/player.js',
123             ],
124             'output_filename': 'js/player.min.js',
125         },
126         'book': {
127             'source_filenames': [
128                 'js/contrib/jquery.eventdelegation.js',
129                 'js/contrib/jquery.scrollto.js',
130                 'js/contrib/jquery.highlightfade.js',
131                 'js/book_text/other.js',
132                 'js/book.js',
133
134                 'js/contrib/raphael-min.js',
135                 'js/contrib/progressSpin.min.js',
136                 'js/picture.js',
137             ],
138             'output_filename': 'js/book.min.js',
139         },
140         'book_text': {
141             'source_filenames': [
142                 'js/contrib/jquery.form.js',
143                 'js/contrib/jquery.jqmodal.js',
144                 'js/book_text/info.js',
145                 'js/book_text/menu.js',
146                 'js/book_text/note.js',
147                 'js/book_text/settings.js',
148                 'js/book_text/toc.js',
149                 'js/locale.js',
150                 'js/dialogs.js',
151
152                 'js/contrib/jquery.highlightfade.js',
153                 'js/contrib/raphael-min.js',
154                 'player/openplayer.js',
155                 'js/contrib/progressSpin.min.js',
156                 'js/annoy.js',
157             ],
158             'output_filename': 'js/book_text.js',
159         },
160         'picture': {
161             'source_filenames': [
162                 'js/picture.js',
163             ],
164             'output_filename': 'js/picture.min.js',
165         },
166         'book_ie': {
167             'source_filenames': ('js/contrib/ierange-m2.js',),
168             'output_filename': 'js/book_ie.min.js',
169         },
170         'widget': {
171             'source_filenames': (
172                 'js/contrib/jquery.js',
173                 'js/contrib/jquery-ui-1.8.16.custom.min.js',
174                 'js/search.js',
175                 'js/widget_run.js',
176             ),
177             'output_filename': 'js/widget.min.js',
178         },
179     },
180     'CSS_COMPRESSOR': None,
181     'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor',
182     'COMPILERS': (
183         'pipeline.compilers.sass.SASSCompiler',
184         # We could probably use PySCSS instead,
185         # but they have some serious problems, like:
186         # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax)
187         # https://github.com/Kronuz/pyScss/issues/258 (bad @media order)
188         # 'pyscss_compiler.PySCSSCompiler',
189     )
190 }
191
192 STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineCachedStorage'
193 #STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
194
195 # PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
196 # PIPELINE_PYSCSS_ARGUMENTS = ''
197
198
199 STATICFILES_FINDERS = [
200     'django.contrib.staticfiles.finders.FileSystemFinder',
201     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
202     'pipeline.finders.CachedFileFinder',
203     'pipeline.finders.PipelineFinder',
204 ]
205
206
207 from machina import MACHINA_MAIN_STATIC_DIR
208 STATICFILES_DIRS = (
209     MACHINA_MAIN_STATIC_DIR,
210 )