From 98e0a930cfa272933e787fb5d60073a005b2ee27 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Mon, 6 Dec 2021 12:22:00 +0100 Subject: [PATCH] hacking upload + generation --- Makefile | 2 +- app.py | 5 +++-- templates/index.html | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b5023e7..704724b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ default: run run: - @mkdir -p metadatum generated && \ + @mkdir -p metadatum static/generated && \ FLASK_ENV=development FLASK_APP=app flask run diff --git a/app.py b/app.py index 4cc5cf2..6b895b9 100644 --- a/app.py +++ b/app.py @@ -50,11 +50,12 @@ def upload(): metadata_fpath = os.path.join(CWD, "metadatum", filename) f.save(metadata_fpath) - pdf = os.path.join(CWD, "generated", "test.pdf") + pdf = os.path.join(CWD, "static", "generated", "{}.pdf".format(filename)) metadata = "sqlite:///{}".format(os.path.join(CWD, "metadatum", filename)) make_cards( pdf, metadata, ["title", "timestamp", "comments", "authors"], ["tags"] ) - return render_template("index.html", upload_form=upload_form, pdf=pdf) + pdf_url = url_for("static", filename="generated/{}.pdf".format(filename)) + return render_template("index.html", upload_form=upload_form, pdf=pdf_url) return render_template("index.html", upload_form=upload_form) diff --git a/templates/index.html b/templates/index.html index 93ed6e5..12e446e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -41,9 +41,9 @@ - {% if pdf %} -

FOOOO

- {% endif %} + + +