latin/app/routes.py

32 lines
924 B
Python
Raw Normal View History

from app import app
from flask import render_template, jsonify
import os
2020-10-15 23:33:52 +02:00
capitula = [
{'title': '01 Imperium Romanum'},
{'title': '02 Familia Romana'},
{'title': '03 Puer Improbus'},
{'title': '04 Dominus et Servi'},
{'title': '05 Villa et Hortus'},
{'title': '06 Via Latina'},
{'title': '07 Puella et Rosa'},
{'title': '08 Taberna Romana'},
{'title': '09 Pastor et Oves'},
{'title': '10 Bestiae et Homines'}
]
2020-10-15 23:33:52 +02:00
for capitulum in capitula:
capitulum['filename'] = capitulum['title'].replace(' ', '_')
2020-10-15 23:33:52 +02:00
@app.route('/')
@app.route('/index')
@app.route('/llpsi')
def llpsi():
return render_template('index.html', capitula=capitula)
@app.route('/llpsi/<path:pensum_id>')
def pensum(pensum_id):
filename = app.root_path + '/templates/Pensa/' + pensum_id + '.html'
with open(filename, 'r') as file:
return render_template('Pensum_cloze.html', pensum_title=pensum_id.replace('_', ' '), pensum_content=file.read())