from app import app from flask import render_template import os @app.route('/') @app.route('/index') def index(): return "Hello, World!" @app.route('/latin') def latin(): return render_template('latin.html') @app.route('/latin/llpsi') def llpsi(): return render_template('LLPSI/LLPSI.html') @app.route('/latin/llpsi/') def pensum(pensum_id): filename = 'templates/Pensa/' + pensum_id + '.html' with open(filename, 'r') as file: return render_template('LLPSI/Pensum_cloze.html', pensum_content=file.read()) @app.route('/latin/coniugationes') def coniugationes(): return render_template('coniugationes.html') @app.route('/latin/coniugationes/quod', methods=["GET", "POST"]) def coniugationes_test(): form = ConjugatioAnswer() if form.validate_on_submit(): word = Word.query.filter_by(dictionarium=form.word.data).first() if not form.next_word.data: if int(form.radio.data) == word.coniugatio: return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, success = True) return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form, fail = True) word = Word.query.order_by(func.random()).first() form.word.data = word.dictionarium return render_template('coniugationes.html', dictionarium = word.dictionarium, form = form)