1 Commits

Author SHA1 Message Date
Simon Caminada
919dd33373 fix: local docker-compose setup 2022-06-29 12:40:27 +02:00
13 changed files with 32 additions and 147 deletions

View File

@@ -1,40 +1,21 @@
version: '3'
services:
nginx:
image: nginx:1.16-alpine
restart: unless-stopped
volumes:
- ./docker/conf/nginx:/etc/nginx/conf.d
- ./docker/static_collected:/app/static_collected
- ${MEDIA_DIR}:/app/data/media
ports:
- ${HTTP_PORT}:80
#command: "/bin/sh -c 'while :; do sleep 1m & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
depends_on:
- web
network_mode: bridge
links:
- web
web:
restart: unless-stopped
build: "."
links:
- "db:postgres"
ports:
- "8007:80"
volumes:
- .:/app:rw
- ${DATA_DIR}:/data:rw
- ${STATIC_DIR}:/app/static_collected
- ${MEDIA_DIR}:/app/data/media
network_mode: bridge
command: "/bin/sh -c '/app/wait-for-postgres.sh postgres /app/run.sh'"
- ".:/app:rw"
- "./data:/data:rw"
command: python manage.py runserver 0.0.0.0:80
env_file:
- ./.env
db:
restart: unless-stopped
image: postgres:9.6-alpine
env_file:
- ./.env-db
volumes:
- ${POSTGRES_DATA_DIR}:/var/lib/postgresql/data:rw
network_mode: bridge
- ".:/app:rw"

View File

@@ -38,4 +38,3 @@
@import "modules/plugins/_timetable.scss";
@import "modules/plugins/_reference_list.scss";
@import "modules/plugins/_form.scss";
@import "modules/plugins/_iframe.scss";

View File

@@ -1,3 +0,0 @@
.iframe {
margin: em(50px) 0;
}

View File

@@ -38,8 +38,3 @@ django-meta==1.7.0
tablib==0.14.0
django-simple-sso==0.14.1
easy-thumbnails==2.7.1
dj-database-url==0.5.0
django-js-asset==1.2.3
idna==3.4
cssselect==1.1.0
lxml-html-clean==0.1.1

View File

@@ -264,9 +264,3 @@ RECAPTCHA_PUBLIC_KEY = '6LeILd0ZAAAAAB9xO_y8kS292wv2ikl0M8s7zFn9'
RECAPTCHA_PRIVATE_KEY = '6LeILd0ZAAAAAOGF1AvxdiGcXWLjr2BzHaQ8Zush'
RECAPTCHA_SCORE_THRESHOLD = 0.5
ALDRYN_FORMS_ACTION_BACKENDS = {
'default': 'project.action_backends.DefaultAction',
'email_only': 'aldryn_forms.action_backends.EmailAction',
'none': 'aldryn_forms.action_backends.NoAction',
}

View File

@@ -1,13 +0,0 @@
# -*- coding: utf-8 -*-
from aldryn_forms.action_backends_base import BaseAction
class DefaultAction(BaseAction):
verbose_name = 'Default'
def form_valid(self, cmsplugin, instance, request, form):
email = form.cleaned_data.get('emailfield_1', None)
if email and email in ['eric.jones.z.mail@gmail.com']:
return
recipients = cmsplugin.send_notifications(instance, form)
form.instance.set_recipients(recipients)
form.save()

View File

@@ -15,7 +15,7 @@ from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
from project.forms import NewsletterSubscriptionForm
from project.models import Section, Quote, SliderItem, SectionText, Video, DownloadSection, DownloadSectionFolder, \
TextSliderItem, HighlightListItem, ReferenceListItem, SocialMediaList, SocialMediaListItem, Timetable, \
TimetableItem, Partner, HighlightList, Image, TitleListItem, TitleList, IntroImage, Gallery, Iframe
TimetableItem, Partner, HighlightList, Image, TitleListItem, TitleList, IntroImage, Gallery
@plugin_pool.register_plugin
@@ -29,7 +29,7 @@ class SectionPlugin(CMSPluginBase):
'SectionTextPlugin', 'VideoPlugin', 'DownloadSectionPlugin', 'TextSliderPlugin',
'HighlightListPlugin', 'ReferenceListPlugin', 'FormPlugin', 'PicturePlugin', 'SubPageListPlugin',
'PartnerPlugin', 'NewsletterSubscriptionPlugin', 'NewsletterArchivePlugin',
'SocialMediaListPlugin', 'GalleryPlugin', 'IframePlugin']
'SocialMediaListPlugin', 'GalleryPlugin']
@plugin_pool.register_plugin
@@ -348,11 +348,3 @@ class GalleryPlugin(CMSPluginBase):
module = 'Content'
name = 'Gallery'
render_template = 'project/plugins/content/gallery.html'
@plugin_pool.register_plugin
class IframePlugin(CMSPluginBase):
model = Iframe
module = 'Content'
name = 'Iframe'
render_template = 'project/plugins/content/iframe.html'

View File

@@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2024-05-23 15:51
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0020_old_tree_cleanup'),
('project', '0011_auto_20211104_1608'),
]
operations = [
migrations.CreateModel(
name='Iframe',
fields=[
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='project_iframe', serialize=False, to='cms.CMSPlugin')),
('html', models.TextField(verbose_name='HTML')),
],
options={
'verbose_name': 'Iframe',
'verbose_name_plural': 'Iframes',
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View File

@@ -349,14 +349,3 @@ class Gallery(CMSPlugin):
@property
def files(self):
return self.folder.files.all().order_by('name')
class Iframe(CMSPlugin):
html = models.TextField('HTML')
class Meta(CMSPlugin.Meta):
verbose_name = 'Iframe'
verbose_name_plural = 'Iframes'
def __str__(self):
return self.html

View File

@@ -177,14 +177,12 @@
<div id="privacy-message" style="display: none;">
<div class="privacy-message__frame">
<p>
{% page_url 'privacy' as privacy_url %}
{% if LANGUAGE_CODE == 'de' %}
{% page_url 'imprint' as privacy_url %}
{% blocktrans with privacy_url=privacy_url %}
Um diese Webseite optimal gestalten und fortlaufend verbessern zu können, verwenden wir Cookies.
Weitere Informationen finden Sie in unserer <a href="{{ privacy_url }}">Datenschutzerklärung</a>.
{% else %}
In order to optimize this website and to continuously improve it, we use cookies.
Further information can be found in our <a href="{{ privacy_url }}">data protection policy</a>.
{% endif %}
Weitere Informationen finden Sie in unserer
<a href="{{ privacy_url }}">Datenschutzerklärung im Impressum</a>.
{% endblocktrans %}
</p>
<div class="privacy-message__actions">
<a href="#" class="button button--small button--ghost privacy_action--decline">
@@ -210,20 +208,30 @@
<script>
$(function() {
var init_tag_manager = function() {
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WVRJ872');
var init_google_analytics = function() {
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-116863155-1', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
};
if (window.privacy_accepted) {
init_tag_manager();
init_google_analytics();
}
$('body').on('enable_tracking', function() {
init_tag_manager();
init_google_analytics();
});
});
</script>

View File

@@ -1,5 +0,0 @@
<div class="iframe reveal_container">
<div class="reveal reveal_animation">
<div style="display:inline-block;vertical-align:top;width:300px;margin:20px auto;color:#333;background:#fff;border:1px solid #ddd;line-height:1.2;text-decoration:none;padding:0"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer"><img src="https://assets.api.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/books/3EzILpspTZubAkL9btIklA/cover/share" style="max-height:300px;max-width:100%;display:block;margin:0 auto;padding:0;border:none" alt="Unsere Lieblingstiere"/></a><div style="display:block;padding:20px;overflow:hidden;overflow-x:hidden;border-top:1px solid #ddd"><div style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal;font-size:21px;margin:0 0 0.25em"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">Unsere Lieblingstiere</a></div><div style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal;font-size:16px;margin:0 0 0.5em"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">Click to read this book, made with Book Creator</a></div><div style="display:block;color:#455a64;line-height:1.2;text-decoration:none;padding:0;font-weight:bold;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px"><a href="https://read.bookcreator.com/Y0SYhDEKm4Wfw50K2K1EsVR6BSO2/3EzILpspTZubAkL9btIklA" style="display:block;color:#333;line-height:1.2;text-decoration:none;padding:0;font-weight:normal" target="_blank" rel="noreferrer">read.bookcreator.com</a></div></div></div>
</div>
</div>

View File

@@ -3,7 +3,7 @@ from django.conf.urls import url, include
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import TemplateView
from project.views import SearchView, NewsletterSubscriptionView, LoginRedirectView, MediaRedirectView, ArchiveFilerPublic
from project.views import SearchView, NewsletterSubscriptionView, LoginRedirectView, MediaRedirectView
urlpatterns = [
url(_(r'^suche/'), SearchView.as_view(), kwargs={'search': True}, name='search'),
@@ -13,5 +13,4 @@ urlpatterns = [
name='newsletter_subscription_success'),
url(r'^login/redirect/$', LoginRedirectView.as_view(), name='login_redirect'),
url(r'^media/bridge/$', MediaRedirectView.as_view(), name='media_bridge'),
url(r'^media/archive/$', ArchiveFilerPublic.as_view(), name='media_archive'),
]

View File

@@ -2,7 +2,6 @@
from aldryn_search.views import AldrynSearchView
from cms.models import Page
from django.core.urlresolvers import reverse_lazy
from django.views import View
from django.views.generic import RedirectView
from django.views.generic.edit import FormView
from aldryn_forms.admin.views import FormExportWizardView
@@ -10,8 +9,6 @@ from aldryn_forms.admin.exporter import Exporter
from tablib import Dataset
from django.http import HttpResponse
from project.forms import NewsletterSubscriptionForm
import os
import zipfile
class SearchView(AldrynSearchView):
@@ -105,21 +102,3 @@ class CustomFormExportWizardView(FormExportWizardView):
response = HttpResponse(dataset.xls, content_type=content_type)
response['Content-Disposition'] = 'attachment; filename=%s' % filename
return response
class ArchiveFilerPublic(View):
def get(self, request):
path = '/app/data/media/filer_public/'
with zipfile.ZipFile('filer_public.zip', 'w', zipfile.ZIP_DEFLATED) as zipf:
for root, dirs, files in os.walk(path):
for file in files:
filePath = os.path.join(root, file)
try:
with open(filePath) as tempFile:
pass
zipf.write(filePath, os.path.relpath(filePath, os.path.join(path, '..')))
except IOError:
print(filePath)
return HttpResponse('success')