This is a reusable plain version the varia library website. You can host your own website of books using just a simple csv file
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.

53 lines
1.3 KiB

"""This is the main flask library page"""
import flask
from flask import render_template
from rnrfeed.rnrfeeder import getevents
from csvparser.csvparser import (
getlicenses,
getpublications,
gettypes,
getyears,
getfullpublication,
)
APP = flask.Flask(__name__, static_folder="static")
@APP.route("/")
def index():
"""Main route, shows all the books and you can filter them, a bit"""
pubtypes = gettypes()
pubyears = getyears()
publicenses = getlicenses()
publicatons = getpublications()
template = render_template(
"index.html",
publications=publicatons,
pubtypes=pubtypes,
pubyears=pubyears,
publicenses=publicenses,
)
return template
@APP.route("/<publicationID>")
def show_book(publicationID):
"""route for a publication, still needs to be made"""
fullpublication = getfullpublication(publicationID)
# parse csv, render template with full list.
return render_template("publication.html", fullpublication=fullpublication)
@APP.route("/pastevents")
def pastevents():
"""show past events and book recommendations"""
events = getevents()
return render_template("pastevents.html", events=events)
if __name__ == "__main__":
APP.debug = True
APP.run(port=5000)