COPY scripts/nginx.conf /etc/nginx/conf.d/default.conf
RUN addgroup -g $GID app && addgroup nginx app
-COPY --from=static-builder /app/src/static /app/var/static
+COPY --from=static-builder /app/var/static /app/var/static
FROM prod-base AS prod
-COPY --from=static-builder /app/src/static/staticfiles.json /app/src/static/staticfiles.json
+COPY --from=static-builder /app/var/static/staticfiles.json /app/var/static/staticfiles.json
def test_preview_from_bad_xml(self):
response = self.client.post('/cover/preview/', data={"xml": ''})
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.content, b'/media/static/img/sample_cover.png')
+ self.assertEqual(response.content, b'/static/img/sample_cover.png')
@patch('cover.views.make_cover')
def test_preview_from_minimal_xml(self, make_cover):
response = self.client.post('/cover/preview/', data={"xml": SAMPLE_XML})
self.assertEqual(response.status_code, 200)
- self.assertIn(b'/media/dynamic/cover/preview/', response.content)
+ self.assertIn(b'/media/cover/preview/', response.content)
def test_bad_book(self):
response = self.client.get('/cover/preview/test/')
def test_image_file(self):
response = self.client.get('/cover/image/1/file/')
- self.assertRegex(response['Location'], r'^/media/dynamic/cover/image/')
+ self.assertRegex(response['Location'], r'^/media/cover/image/')
</ul>
</div>
<div id="header">
- <a href="/"><img src="/media/static/img/logo-220.png" alt="Wolne Lektury" /></a>
+ <a href="/"><img src="/static/img/logo-220.png" alt="Wolne Lektury" /></a>
</div>
{{ html|safe }}
</body>
def settings(request):
from django.conf import settings
- if settings.SHOW_APP_VERSION:
- import subprocess
- process = subprocess.Popen(["git", "show", "--oneline"], stdout=subprocess.PIPE)
- data, _err = process.communicate()
- # get app version
- VERSION = data.splitlines()[0].split()[0]
- else:
- VERSION = ''
-
return {
'MEDIA_URL': settings.MEDIA_URL,
'STATIC_URL': settings.STATIC_URL,
- 'APP_VERSION': VERSION,
}
#
import os
-PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
-
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = PROJECT_ROOT + '/media/dynamic'
-STATIC_ROOT = PROJECT_ROOT + '/../static/'
-CATALOGUE_REPO_PATH = MEDIA_ROOT + '/repo'
-CATALOGUE_IMAGE_REPO_PATH = MEDIA_ROOT + '/imgrepo'
+MEDIA_ROOT = '/app/var/media'
+STATIC_ROOT = '/app/var/static'
+CATALOGUE_REPO_PATH = '/app/var/dvcs'
+CATALOGUE_IMAGE_REPO_PATH = '/app/var/dvcs-img'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = '/media/dynamic/'
-STATIC_URL = '/media/static/'
+MEDIA_URL = '/media/'
+STATIC_URL = '/static/'
SESSION_COOKIE_NAME = "redakcja_sessionid"
IMAGE_DIR = 'images/'
-BROKER_URL = 'django://'
-
-SHOW_APP_VERSION = False
-
CAS_SERVER_URL = None
CAS_APPLY_ATTRIBUTES_TO_USER = True
CAS_RENAME_ATTRIBUTES = {
let self = this;
xml2html({
xml: this.doc.text,
- base: this.doc.getBase(),
success: function(element){
var htmlView = $('#html-view');
(function($){
- let w = function() {};
- w = console.log;
-
const elementDefs = {
"ilustr": {
"attributes": [
html2text({
element: self.$edited[0],
success: function(xml) {
- w(222)
let $xmlelem = $($.parseXML(xml));
- w(333, $xmlelem)
- w($input.data('property'), $input.val());
$xmlelem.contents().attr($input.data('property'), inputval);
- w(444, $xmlelem)
let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]);
- w(555, newxml)
xml2html({
xml: newxml,
- base: self.doc.getBase(),
success: function(html) {
let htmlElem = $(html);
self.$edited.replaceWith(htmlElem);
text = $.trim(text.replace(/\s{2,}/g, ' '));
return text.length;
}
-
- /* Temporary workaround for relative images. */
- getBase() {
- return '/media/dynamic/images/' + this.galleryLink + '/';
- }
}
$.wikiapi.WikiDocument = WikiDocument;
source.text('');
options.error(error.text(), source_text);
} else {
- let galleryUrl = new URL(
- options.base,
- window.location.href
- );
$("img", $(doc.childNodes)).each(function() {
$(this).attr(
'src',
- new URL(
- $(this).attr('src'),
- galleryUrl
- )
+ $(this).attr('src'),
);
})
</div>
</div>
- <!-- version: {{ APP_VERSION }} -->
{% block maincontent %} {% endblock %}
<script
src="https://code.jquery.com/jquery-1.9.1.min.js"