flaskapp / app.py
huiiz's picture
1
2d73c0d
raw
history blame contribute delete
421 Bytes
import time
from flask import Flask, redirect, url_for
app = Flask(__name__)
updates = ["INIT"]
@app.route("/")
def hello_world():
update_times = "\n".join([f"<li>{i}</li>" for i in updates])
return f"<p>Hello, World!</p><hr><h2>UPDATES</h2>{update_times}"
@app.route("/update")
def update():
current_time = time.ctime()
updates.append(str(current_time))
return redirect(url_for('hello_world'))