You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
986 B
44 lines
986 B
"""This is the main flask page code"""
|
|
|
|
|
|
import flask
|
|
from flask import render_template
|
|
|
|
from csvparser.csvparser import getpublications, gettypes, getyears
|
|
|
|
APP = flask.Flask(__name__, static_folder="static")
|
|
|
|
|
|
@APP.route("/")
|
|
def index():
|
|
"""Main route"""
|
|
# parse csv, render template with a few elements from the csv
|
|
pubtypes = gettypes()
|
|
pubyears = getyears()
|
|
publicatons = getpublications()
|
|
template = render_template(
|
|
"index.html",
|
|
publications=publicatons,
|
|
pubtypes=pubtypes,
|
|
pubyears=pubyears
|
|
)
|
|
return template
|
|
|
|
|
|
@APP.route("/<publicationID>")
|
|
def show_book(publicationID):
|
|
"""route for a publication"""
|
|
# parse csv, render template with full list.
|
|
return render_template("publication.html")
|
|
|
|
|
|
@APP.route("/<publication>")
|
|
def upload_book(publication):
|
|
"""upload a new book"""
|
|
#
|
|
return render_template("upload.html")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
APP.debug = True
|
|
APP.run(port=5000)
|
|
|