Fix downloading images on publish.
[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         '2022': {
26             'source_filenames': [
27                 'contrib/jquery-ui-1.13.1.custom/jquery-ui.css',
28                 '2022/styles/main.scss',
29                 '2022/more.scss', 
30             ],
31             'output_filename': 'css/compressed/2022.css',
32         },
33         'main': {
34             # styles both for mobile and for big screen
35             'source_filenames': [
36                 'css/import/gelasio.css',
37
38                 'css/jquery.countdown.css',
39                 'jplayer/jplayer.blue.monday.css',
40
41                 'sponsors/css/sponsors.css',
42
43                 'annoy/banner.scss',
44
45                 'css/ui-lightness/jquery-ui-1.8.16.custom.css',
46
47                 'css/tlite.css',
48
49                 'scss/main.scss',
50                 'club/club.scss',
51             ],
52             'output_filename': 'css/compressed/main.css',
53         },
54         'book': {
55             'source_filenames': [
56                 'css/import/gelasio.css',
57                 'css/master.book.css',
58             ],
59             'output_filename': 'css/compressed/book.css',
60         },
61         'book_text': {
62             'source_filenames': [
63                 'css/import/gelasio.css',
64                 'scss/book_text.scss',
65                 'css/new.book.css',
66                 'annoy/banner.scss',
67                 'annoy/book_text.scss',
68
69                 'css/master.picture.css',
70             ],
71             'output_filename': 'css/compressed/book_text.css',
72         },
73         'forum': {
74             'source_filenames': [
75                 'scss/forum.scss',
76             ],
77             'output_filename': 'css/compressed/compressed/forum.css',
78         },
79         'picture': {
80             'source_filenames': [
81                 'css/import/gelasio.css',
82                 'css/master.book.css',
83                 'css/master.picture.css',
84             ],
85             'output_filename': 'css/compressed/picture.css',
86         },
87         'player': {
88             'source_filenames': [
89                 'jplayer/jplayer.blue.monday.css',
90                 'player/player.css',
91             ],
92             'output_filename': 'css/compressed/player.css',
93         },
94         'simple': {
95             'source_filenames': ('css/simple.css',),
96             'output_filename': 'css/compressed/simple.css',
97         },
98         'widget': {
99             'source_filenames': ('scss/widget.scss',),
100             'output_filename': 'css/compressed/widget.css',
101         },
102     },
103     'JAVASCRIPT': {
104         'base': {
105             'source_filenames': (
106                 'js/contrib/jquery.cycle2.min.js',
107                 'js/contrib/jquery.jqmodal.js',
108                 'js/contrib/jquery.form.js',
109                 'js/contrib/jquery.paging.min.js',
110                 'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js',
111                 'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js',
112                 'js/contrib/jquery.countdown-es.js', 'js/contrib/jquery.countdown-lt.js',
113                 'js/contrib/jquery.countdown-ru.js', 'js/contrib/jquery.countdown-fr.js',
114                 'js/contrib/jquery.shorten.js',
115
116                 'js/contrib/jquery-ui-1.8.16.custom.min.js',
117
118                 'js/contrib/tlite.min.js',
119
120                 'jplayer/jquery.jplayer.min.js',
121                 'jplayer/jplayer.playlist.min.js',
122                 'player/player.js',
123
124                 'js/locale.js',
125                 'js/dialogs.js',
126                 'js/base.js',
127                 'pdcounter/pdcounter.js',
128                 'sponsors/js/sponsors.js',
129                 'player/openplayer.js',
130                 'js/search.js',
131                 'funding/funding.js',
132                 'club/form.js',
133
134                 'annoy/banner.js',
135                 ),
136             'output_filename': 'js/base.min.js',
137         },
138         '2022': {
139             'source_filenames': [
140                 'contrib/jquery-ui-1.13.1.custom/jquery-ui.js',
141                 'js/search.js',
142                 'js/2022.js',
143             ],
144             'output_filename': 'js/2022.min.js'
145         },
146         'player': {
147             'source_filenames': [
148                 'jplayer/jquery.jplayer.min.js',
149                 'jplayer/jplayer.playlist.min.js',
150                 'player/player.js',
151             ],
152             'output_filename': 'js/player.min.js',
153         },
154         '2022_player': {
155             'source_filenames': [
156                 'js/contrib/jplayer/jquery.jplayer.min.js',
157                 'js/contrib/jplayer/jplayer.playlist.min.js',
158                 'player/2022_player.js',
159             ],
160             'output_filename': 'js/2022_player.min.js',
161         },
162         'book': {
163             'source_filenames': [
164                 'js/contrib/jquery.eventdelegation.js',
165                 'js/contrib/jquery.scrollto.js',
166                 'js/contrib/jquery.highlightfade.js',
167                 'js/book_text/other.js',
168                 'js/book.js',
169
170                 'js/contrib/raphael-min.js',
171                 'js/contrib/progressSpin.min.js',
172                 'js/picture.js',
173             ],
174             'output_filename': 'js/book.min.js',
175         },
176         'book_text': {
177             'source_filenames': [
178                 'js/contrib/jquery.cycle2.min.js',
179                 'js/contrib/jquery.form.js',
180                 'js/contrib/jquery.jqmodal.js',
181                 'js/book_text/info.js',
182                 'js/book_text/menu.js',
183                 'js/book_text/note.js',
184                 'js/book_text/references.js',
185                 'js/book_text/settings.js',
186                 'js/book_text/toc.js',
187                 'js/locale.js',
188                 'js/dialogs.js',
189                 'annoy/book_text.js',
190
191                 'js/contrib/jquery.highlightfade.js',
192                 'js/contrib/raphael-min.js',
193                 'player/openplayer.js',
194                 'js/contrib/progressSpin.min.js',
195                 'annoy/banner.js',
196             ],
197             'output_filename': 'js/book_text.js',
198         },
199         'picture': {
200             'source_filenames': [
201                 'js/picture.js',
202             ],
203             'output_filename': 'js/picture.min.js',
204         },
205         'book_ie': {
206             'source_filenames': ('js/contrib/ierange-m2.js',),
207             'output_filename': 'js/book_ie.min.js',
208         },
209         'widget': {
210             'source_filenames': (
211                 'js/contrib/jquery.js',
212                 'js/contrib/jquery-ui-1.8.16.custom.min.js',
213                 'js/search.js',
214                 'js/widget_run.js',
215             ),
216             'output_filename': 'js/widget.min.js',
217         },
218     },
219     'CSS_COMPRESSOR': None,
220     'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor',
221     'COMPILERS': (
222         'libsasscompiler.LibSassCompiler',
223     )
224 }
225
226 STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineCachedStorage'
227 #STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
228
229 # PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
230 # PIPELINE_PYSCSS_ARGUMENTS = ''
231
232
233 STATICFILES_FINDERS = [
234     'django.contrib.staticfiles.finders.FileSystemFinder',
235     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
236     'pipeline.finders.CachedFileFinder',
237     'pipeline.finders.PipelineFinder',
238 ]
239
240
241 from machina import MACHINA_MAIN_STATIC_DIR
242 STATICFILES_DIRS = (
243     MACHINA_MAIN_STATIC_DIR,
244 )