test static files

master
km0 3 years ago
parent 422eb8bba9
commit a85c029bbc

3
.gitmodules vendored

@ -1,6 +1,3 @@
[submodule "postit/contents"]
path = postit/contents
url = https://git.xpub.nl/kamo/post-it-contents.git
[submodule "postit/static/contents"]
path = postit/static/contents
url = https://git.xpub.nl/kamo/post-it-contents.git

@ -1 +0,0 @@
Subproject commit 20cb7eff9cba3dee5912d7893729b8a8490903f9

@ -5,7 +5,7 @@ import os
def dump():
# list all the folders
path = "postit/contents"
path = "postit/static/contents"
folders = [
f.name for f in os.scandir(path) if f.is_dir() and f.name != "miri-the-leader"
]

@ -20,10 +20,3 @@ def postit():
contents = json.load(f)
return render_template("postit.html", contents=contents)
@bp.route("/<slug>/<filename>/")
def send_static(slug=None, filename=None):
return send_from_directory(
f'{os.environ.get("URL_PREFIX")}/postit/contents/{slug}', filename
)

@ -13,7 +13,7 @@
<div class="post-it">
{%if content['img'] %}
<img
src="{{content['slug']}}/{{content['img']}}"
src="{{url_for('static', filename='contents/' + content['slug'] + '/' + content['img'] )}}"
alt="{{content['description']}}"
/>
<figcaption>{{content['description']}}</figcaption>

Loading…
Cancel
Save