tmpl-flask/flaskapp/pages.py

29 lines
611 B
Python

"""Main Flask app routes"""
from flask import render_template
from . import routes
from . import db
class RoutePages(routes.Routes):
"""Main Flask app routes"""
def add_routes(self) -> None:
@self.app.route('/')
def index():
return render_template('index.html')
@self.app.route('/db')
def table():
cur = db.get_cursor()
cur.execute(f'SELECT * FROM {db.TABLE}')
rows = cur.fetchall()
cur.close()
return render_template(
'table.html',
rows=rows,
)