hacking upload + generation

This commit is contained in:
cellarspoon 2021-12-06 12:22:00 +01:00
parent 2a81116db6
commit 98e0a930cf
No known key found for this signature in database
GPG Key ID: 03789458B3D0C410
3 changed files with 7 additions and 6 deletions

View File

@ -1,5 +1,5 @@
default: run
run:
@mkdir -p metadatum generated && \
@mkdir -p metadatum static/generated && \
FLASK_ENV=development FLASK_APP=app flask run

5
app.py
View File

@ -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)

View File

@ -41,9 +41,9 @@
</form>
{% if pdf %}
<p> FOOOO </p>
{% endif %}
<object data="{{ pdf }}" type="application/pdf">
<iframe src="{{ pdf }}"></iframe>
</object>
</body>
</html>