2024-09-12 18:01:10 -04:00
|
|
|
from flask import Flask, render_template, redirect
|
|
|
|
import datetime
|
2024-09-12 17:38:04 -04:00
|
|
|
|
|
|
|
app = Flask(__name__);
|
|
|
|
|
|
|
|
last_value: str
|
|
|
|
|
|
|
|
try:
|
|
|
|
with open("bozo", 'r') as f:
|
|
|
|
last_value: str = f.read()
|
|
|
|
except:
|
|
|
|
with open("bozo", 'w+') as f:
|
2024-09-12 18:01:10 -04:00
|
|
|
last_value = str(datetime.date.today())
|
2024-09-12 17:38:04 -04:00
|
|
|
f.write(last_value)
|
|
|
|
|
|
|
|
@app.route("/api/update", methods = ['POST'])
|
|
|
|
def update():
|
2024-09-12 18:01:10 -04:00
|
|
|
last_value = str(datetime.date.today())
|
|
|
|
print(last_value)
|
|
|
|
with open("bozo", 'w+') as f:
|
|
|
|
f.write(last_value)
|
|
|
|
return render_template('home.html', date = last_value)
|
|
|
|
|
|
|
|
@app.route("/", methods = ['GET'])
|
|
|
|
def normal():
|
|
|
|
print(last_value)
|
|
|
|
return render_template('home.html', date = last_value)
|
2024-09-12 17:38:04 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(host='0.0.0.0', port=5000, debug=1)
|