2023-02-15 19:55:06 +04:00
|
|
|
"""Main Flask app routes"""
|
|
|
|
|
|
|
|
from flask import render_template
|
|
|
|
|
|
|
|
from . import routes
|
2023-02-16 18:19:58 +04:00
|
|
|
from . import db
|
2023-02-15 19:55:06 +04:00
|
|
|
|
|
|
|
|
|
|
|
class RoutePages(routes.Routes):
|
|
|
|
"""Main Flask app routes"""
|
|
|
|
|
|
|
|
def add_routes(self) -> None:
|
|
|
|
|
|
|
|
@self.app.route('/')
|
|
|
|
def index():
|
|
|
|
return render_template('index.html')
|
2023-02-16 18:19:58 +04:00
|
|
|
|
|
|
|
@self.app.route('/db')
|
|
|
|
def table():
|
|
|
|
|
|
|
|
cur = db.get_cursor()
|
2023-02-16 18:25:40 +04:00
|
|
|
cur.execute(f'SELECT * FROM {db.TABLE}')
|
2023-02-16 18:19:58 +04:00
|
|
|
rows = cur.fetchall()
|
|
|
|
cur.close()
|
|
|
|
|
|
|
|
return render_template(
|
|
|
|
'table.html',
|
|
|
|
rows=rows,
|
|
|
|
)
|