from flask import Flask, render_template, request, session import modify_csv import read_cat app = Flask(__name__) app.secret_key = "Start1234!" @app.get("/") def index(): return render_template( "index.html", sitename="Ausgaben der Familie", data=modify_csv.read_csv_file(), sum_all=modify_csv.sum_all(), ) @app.get("/add_ausgabe") def add_ausgabe(): return render_template( "add_ausgabe.html", url="output", select_id_text="add_value", select_id="add_disc", data=read_cat.read_cat_file(), ) @app.post("/output") def csv_output(): modify_csv.write_csv_file( betrag=request.form["add_value"], select_dist=request.form["add_disc"] ) return render_template( "index.html", csv_value_text=request.form["add_value"], csv_value_disc=request.form["add_disc"], data=modify_csv.read_csv_file(), sum_all=modify_csv.sum_all(), ) if __name__ == "__main__": app.run(port=5080, host="0.0.0.0", debug=True)