From 0f02669f5c7a9e2813b874d638afb56369bb4313 Mon Sep 17 00:00:00 2001 From: starnakin Date: Fri, 13 Sep 2024 00:01:10 +0200 Subject: [PATCH] core: use date --- main.py | 23 +++++++++++++---------- templates/home.html | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 templates/home.html diff --git a/main.py b/main.py index 3cf31a3..8347077 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ -from flask import Flask, render_template, request, redirect, session -import time +from flask import Flask, render_template, redirect +import datetime app = Flask(__name__); @@ -10,18 +10,21 @@ try: last_value: str = f.read() except: with open("bozo", 'w+') as f: - last_value = str(time.time() * 1000) + last_value = str(datetime.date.today()) f.write(last_value) -@app.route("/api/update", methods = ['GET']) -def get(): - return str(last_value) - @app.route("/api/update", methods = ['POST']) def update(): - last_value = str(time.time() * 1000) - f.write(last_value) - return + 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) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=1) diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..6a36bb5 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,14 @@ + + + + + Ca42 + + +

Ca42

+

{{date}}

+
+ +
+ +