From 4fdfbc3eb2de2e1d34f13239e5c515d611d6d1f0 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 30 May 2021 19:28:43 +0000 Subject: [PATCH] docker und requirements --- Dockerfile | 14 +++++ requirements.txt | 2 +- simple_sample/__init__.py | 2 +- simple_sample/templates/page_plain.html | 68 +++++++++++++++++++++++++ simple_sample/templates/title.html | 67 ++++++++++++++++++++++++ 5 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 simple_sample/templates/page_plain.html create mode 100644 simple_sample/templates/title.html diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..04f65be --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.8-slim-buster as builder +RUN python -m venv /opt/venv +RUN apt-get update && apt-get install -y build-essential +COPY requirements.txt . +RUN pip install uwsgi +RUN pip install -r requirements.txt +FROM python:3.8-slim-buster +COPY --from=builder /opt/venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +WORKDIR /srv/ +COPY simple_sample . +COPY run.py . +COPY config.cfg . diff --git a/requirements.txt b/requirements.txt index 5913218..eb1f3f8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ flask Frozen-Flask config -uwsgi gevent +https://github.com/andreassteph/flatpages_index/archive/master.zip diff --git a/simple_sample/__init__.py b/simple_sample/__init__.py index 7ccbf75..e14f17b 100644 --- a/simple_sample/__init__.py +++ b/simple_sample/__init__.py @@ -30,7 +30,7 @@ app.config.from_object(__name__) app.logger.setLevel(logging.DEBUG) flatpages = FlatPagesIndex(app) -flatpages_index.Links.endpoint="stuff.post" +flatpages_index.Links.endpoint="stuff.page" flatpages_index.Links.url=(lambda s,x: url_for(s.endpoint, name=x)) #flatpages_index.Links.image_url=(lambda s,x: url_for('stuff.page', name=x)) flatpages_index.Links.file_url=(lambda s,x: url_for('stuff.page', name=x)) diff --git a/simple_sample/templates/page_plain.html b/simple_sample/templates/page_plain.html new file mode 100644 index 0000000..b728cbb --- /dev/null +++ b/simple_sample/templates/page_plain.html @@ -0,0 +1,68 @@ +{# -*-jinja2-*- #} +{% extends "layout.html" %} + +{% block content %} + +

{{post.title}}

+{{post.date}} +{% if post.links["subindexpages"] | length > 0 %} +
+ Unterseiten: + +{% endif %} + +{{ post.html|safe }} + + +{% if post.links.subpages |length > 0 %} +hi + +{% endif %} + +{% if post.links["files"] |length > 0 %} + +
+ +Files: + +{% endif %} + +{% if post.links["images"] |length > 0 %} + +
+ +Images: + +{% endif %} + +{% endblock %} diff --git a/simple_sample/templates/title.html b/simple_sample/templates/title.html new file mode 100644 index 0000000..6f119a2 --- /dev/null +++ b/simple_sample/templates/title.html @@ -0,0 +1,67 @@ +{# -*-jinja2-*- #} +{% extends "layout.html" %} + +{% block content %} + +

{{post.title}}

+{{post.date}} +{% if post.links["subindexpages"] | length > 0 %} +
+ Unterseiten: + +{% endif %} + +{{ post.html|safe }} + + +{% if post.links["subpages"] |length > 0 %} + +{% endif %} + +{% if post.links["files"] |length > 0 %} + +
+ +Files: + +{% endif %} + +{% if post.links["images"] |length > 0 %} + +
+ +Images: + +{% endif %} + +{% endblock %}