move html to templates folder
This commit is contained in:
parent
a3d1d44bb3
commit
a1d438f04d
2 changed files with 12 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
||||||
from flask import Flask,render_template
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from flask import Flask, render_template
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# We request users to send the run number to prevent accidentially getting old requests from a previous run
|
# We request users to send the run number to prevent accidentially getting old requests from a previous run
|
||||||
|
@ -12,28 +13,23 @@ app = Flask(__name__)
|
||||||
# Save progress through time during 1 run
|
# Save progress through time during 1 run
|
||||||
# Save result of different runs
|
# Save result of different runs
|
||||||
|
|
||||||
db = {
|
db = {"current_run": 0, "run_start_timer": None, "run_data": {}}
|
||||||
"current_run": 0,
|
|
||||||
"run_start_timer": None,
|
|
||||||
"run_data": {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
return render_template("index.html")
|
return render_template('index.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/start_run/<run_index>")
|
@app.route("/start_run/<run_index>")
|
||||||
def start_run(run_index):
|
def start_run(run_index):
|
||||||
db["current_run"] = run_index
|
db["current_run"] = run_index
|
||||||
starttime = datetime.datetime.now()
|
starttime = datetime.datetime.now()
|
||||||
db["run_data"][run_index] = {
|
db["run_data"][run_index] = {"starttime": starttime, "data": {}}
|
||||||
"starttime": starttime,
|
|
||||||
"data": {}
|
|
||||||
}
|
|
||||||
# TODO send start request to the first person in the chain. Probably a zeus part already written as example
|
# TODO send start request to the first person in the chain. Probably a zeus part already written as example
|
||||||
return f'Run {run_index} started at {starttime}'
|
return f'Run {run_index} started at {starttime}'
|
||||||
|
|
||||||
|
|
||||||
@app.route("/checkpoint/start/<run>/<index>")
|
@app.route("/checkpoint/start/<run>/<index>")
|
||||||
def checkpoint_start(run, index):
|
def checkpoint_start(run, index):
|
||||||
if db["current_run"] != run:
|
if db["current_run"] != run:
|
||||||
|
@ -51,5 +47,6 @@ def checkpoint_handoff(run, index):
|
||||||
db["run_data"][run]["data"][index]["handoff"] = datetime.datetime.now()
|
db["run_data"][run]["data"][index]["handoff"] = datetime.datetime.now()
|
||||||
return "Success."
|
return "Success."
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
if __name__ == '__main__':
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1></h1>
|
<h1>TEST</h1>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue