Implement reusable upload platform
This commit is contained in:
+24
-3
@@ -1,14 +1,25 @@
|
||||
from flask import Flask, render_template
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from flask import Flask, render_template, send_from_directory
|
||||
|
||||
|
||||
VERSION = "0.1.1"
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
with (ROOT / "config.json").open(encoding="utf-8") as config_file:
|
||||
CONFIG = json.load(config_file)
|
||||
|
||||
|
||||
VERSION = "0.1.2"
|
||||
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.html", version=VERSION)
|
||||
return render_template("index.html", version=VERSION, config=CONFIG)
|
||||
|
||||
|
||||
@app.route("/health")
|
||||
@@ -16,5 +27,15 @@ def health():
|
||||
return "ok", 200
|
||||
|
||||
|
||||
@app.get("/upload-frontend/<path:filename>")
|
||||
def upload_frontend(filename):
|
||||
return send_from_directory(ROOT / "upload" / "frontend", filename)
|
||||
|
||||
|
||||
from routes.api_bp import register_api
|
||||
|
||||
register_api(app, CONFIG)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=False, host="0.0.0.0", port=5000)
|
||||
Reference in New Issue
Block a user