feat: upgrade python version and install frontend in container

This commit is contained in:
Iain Learmonth 2024-11-09 17:12:34 +00:00
parent 3be3a45606
commit a482d5bba8
6 changed files with 77 additions and 30 deletions

View file

@ -1,7 +1,7 @@
import os
from typing import Iterator
from flask import Flask, redirect, url_for
from flask import Flask, redirect, url_for, send_from_directory
from flask.typing import ResponseReturnValue
from prometheus_client.metrics_core import GaugeMetricFamily, CounterMetricFamily
from prometheus_client.registry import Collector
@ -109,8 +109,21 @@ if not_migrating() and 'DISABLE_METRICS' not in os.environ:
REGISTRY.register(AutomationCollector())
@app.route('/ui')
def redirect_ui():
return redirect("/ui/")
@app.route('/ui/', defaults={'path': ''})
@app.route('/ui/<path:path>')
def serve_ui(path):
if path != "" and os.path.exists("app/static/ui/" + path):
return send_from_directory('static/ui', path)
else:
return send_from_directory('static/ui', 'index.html')
@app.route('/')
def index() -> ResponseReturnValue:
# TODO: update to point at new UI when ready
return redirect(url_for("portal.portal_home"))