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 %}