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