33 lines
739 B
Python
33 lines
739 B
Python
import json
|
|
from pathlib import Path
|
|
|
|
from flask import Flask, render_template, send_from_directory
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
with (ROOT / "config.json").open(encoding="utf-8") as config_file:
|
|
CONFIG = json.load(config_file)
|
|
|
|
|
|
VERSION = "0.1.3"
|
|
|
|
app = Flask(__name__, template_folder="templates", static_folder="static")
|
|
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return render_template("index.html", version=VERSION, config=CONFIG)
|
|
|
|
|
|
@app.route("/health")
|
|
def health():
|
|
return "ok", 200
|
|
|
|
|
|
@app.get("/upload-frontend/<path:filename>")
|
|
def upload_frontend(filename):
|
|
return send_from_directory(ROOT / "upload" / "frontend", filename)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run(debug=False, host="0.0.0.0", port=5000) |