Browse Source

updated app.py to include about.html, base.html

main
simoon 3 years ago
parent
commit
4e4736f19e
  1. 19
      app.py

19
app.py

@ -71,7 +71,8 @@ def impose_cards(fpath):
def home(): def home():
upload_form = UploadForm() upload_form = UploadForm()
pname = petname.generate() pname = petname.generate()
pname_msg = "You are now {}".format(pname) pname_msg = "Index of/~{}".format(pname)
# pname_msg = "You are now {}".format(pname)
return render_template( return render_template(
"index.html", "index.html",
upload_form=upload_form, upload_form=upload_form,
@ -79,6 +80,11 @@ def home():
petname_message=pname_msg, petname_message=pname_msg,
) )
@app.route("/about")
def about():
return render_template(
"about.html",
)
@app.route("/upload", methods=["POST"]) @app.route("/upload", methods=["POST"])
def upload(): def upload():
@ -89,8 +95,10 @@ def upload():
pname = upload_form.petname.data pname = upload_form.petname.data
metadata_name = "metadata-{}.db".format(pname) metadata_name = "metadata-{}.db".format(pname)
if not Path(os.path.join(CWD, "metadatum", metadata_name)).exists(): if not Path(os.path.join(CWD, "metadatum", metadata_name)).exists():
flash("Woops, you forgot to upload a metadata file?") flash("Oops, you forgot to upload a metadata file...")
pname_msg = "You are still {}".format(pname) # pname_msg = "You are still {}".format(pname)
pname_msg = "Index of/~{}".format(pname)
return render_template( return render_template(
"index.html", "index.html",
upload_form=upload_form, upload_form=upload_form,
@ -99,7 +107,9 @@ def upload():
) )
pname = upload_form.petname.data pname = upload_form.petname.data
pname_msg = "You are still {}".format(pname) # pname_msg = "You are still {}".format(pname)
pname_msg = "Index of/~{}".format(pname)
metadata_name = "metadata-{}.db".format(pname) metadata_name = "metadata-{}.db".format(pname)
if upload_form.metadata.data: if upload_form.metadata.data:
@ -107,6 +117,7 @@ def upload():
f.save(os.path.join(CWD, "metadatum", metadata_name)) f.save(os.path.join(CWD, "metadatum", metadata_name))
pdf_name = "index-{}.pdf".format(pname) pdf_name = "index-{}.pdf".format(pname)
# pdf_view = "{}.pdf#view=FitH".join(pname)
pdf_path = os.path.join(CWD, "static", "generated", pdf_name) pdf_path = os.path.join(CWD, "static", "generated", pdf_name)
metadata_conn = "sqlite:///{}".format( metadata_conn = "sqlite:///{}".format(
os.path.join(CWD, "metadatum", metadata_name) os.path.join(CWD, "metadatum", metadata_name)

Loading…
Cancel
Save