from flask import Flask, render_template, redirect, url_for from flask_bootstrap import Bootstrap5 from flask_wtf import FlaskForm, CSRFProtect from vals import * from form import FronForm from load import process_form import secrets # Bootstrap-Flask requires this line app = Flask(__name__) foo = secrets.token_urlsafe(16) app.secret_key = foo csrf = CSRFProtect(app) bootstrap = Bootstrap5(app) # all Flask routes below @app.route('/', methods=['GET', 'POST']) def index(): form = FronForm() message = "" if form.btn_cancel.data: return redirect('https://lutemusic.org') if form.validate_on_submit(): process_form(form) return render_template('index_fron.html', form=form, message=message) @app.errorhandler(404) def page_not_found(e): return render_template('404.html'), 404 @app.errorhandler(500) def internal_server_error(e): return render_template('500.html'), 500 if __name__ == '__main__': app.run(debug=True)