mirror of
https://github.com/StefBuwalda/dashboard_test.git
synced 2025-10-30 03:09:59 +00:00
Set up docker auto build, copied from another project
This commit is contained in:
29
app.py
Normal file
29
app.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# 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(debug=True, use_reloader=True)
|
||||
Reference in New Issue
Block a user