25 lines
619 B
Python
25 lines
619 B
Python
from flask import Flask, render_template, jsonify
|
|
import json
|
|
import os
|
|
|
|
app = Flask(__name__, static_folder='static')
|
|
|
|
DATEN_DATEI = "session_daten.json"
|
|
|
|
def lade_daten():
|
|
if os.path.exists(DATEN_DATEI):
|
|
with open(DATEN_DATEI, "r", encoding="utf-8") as f:
|
|
return json.load(f)
|
|
return {"status": "wartend", "sessions": []}
|
|
|
|
@app.route("/")
|
|
def index():
|
|
daten = lade_daten()
|
|
return render_template("dashboard.html", daten=daten)
|
|
|
|
@app.route("/api/daten")
|
|
def api_daten():
|
|
return jsonify(lade_daten())
|
|
|
|
if __name__ == "__main__":
|
|
app.run(host="0.0.0.0", port=5000, debug=True)
|