mirror of
https://github.com/StefBuwalda/dashboard_test.git
synced 2025-10-30 03:09:59 +00:00
30 lines
610 B
Python
30 lines
610 B
Python
# import requests as r
|
|
from flask import jsonify, Flask, render_template
|
|
from poll_services import start_async_loop
|
|
from mem import services
|
|
import threading
|
|
|
|
|
|
# Flask app to serve status
|
|
app = Flask(__name__)
|
|
|
|
|
|
@app.route("/")
|
|
def homepage():
|
|
return render_template("home.html", services=services)
|
|
|
|
|
|
@app.route("/status")
|
|
def status():
|
|
return jsonify([s.to_dict() for s in services])
|
|
|
|
|
|
# Only run if directly running file
|
|
if __name__ == "__main__":
|
|
|
|
t = threading.Thread(target=start_async_loop, daemon=True)
|
|
t.start()
|
|
|
|
# Run flask app
|
|
app.run(port=80, debug=True, use_reloader=False)
|