From 4700686dbf80c746bb057c37a3ba024134e068ae Mon Sep 17 00:00:00 2001 From: Marta Enina Date: Fri, 27 Jan 2023 20:54:30 +0300 Subject: [PATCH] feat: init --- .gitignore | 2 ++ app.py | 13 +++++++++++ requirements.txt | Bin 0 -> 312 bytes templates/app.html | 55 +++++++++++++++++++++++++++++++++++++++++++++ time_counter.py | 18 +++++++++++++++ wsgi.py | 4 ++++ 6 files changed, 92 insertions(+) create mode 100644 .gitignore create mode 100644 app.py create mode 100644 requirements.txt create mode 100644 templates/app.html create mode 100644 time_counter.py create mode 100644 wsgi.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0540009 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +venv/ \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..ab3bcf5 --- /dev/null +++ b/app.py @@ -0,0 +1,13 @@ +from flask import Flask +from flask import render_template +import time_counter + +app = Flask(__name__) + +@app.route('/') +def home(): + return render_template('app.html') + +@app.route('/time') +def getTime(): + return time_counter.getTimeBeforeSummer() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..895e025b4837cdbd69dbf879696bd3adc0283b64 GIT binary patch literal 312 zcmZXPJr9B~7=&*&@vjg*jA3zgFmZBlCW;0@N(vqH$E!~(gcw7P!h84LUEi-lPJ@g( zl_1xKCsm{vBwA{rlNwdL>%iq<9w{3+18Zbe=nnk0-&}!pP;B7~_2ag8{=z#~B= + + + + + + + Ждём лета + + + + +
+

До лета осталось 14д 3ч 24м 30с

+
+ + + \ No newline at end of file diff --git a/time_counter.py b/time_counter.py new file mode 100644 index 0000000..76eb10a --- /dev/null +++ b/time_counter.py @@ -0,0 +1,18 @@ +import datetime + + +def getTimeBeforeSummer(): + n = datetime.datetime.now(tz=None) + year = n.year + + if n.month > 8: + year += 1 + + summer = datetime.datetime(year, 6, 1) + summer_time = summer - n + + h = str(summer_time.seconds // 3600) + m = str((summer_time.seconds % 3600) // 60) + s = str(summer_time.seconds % 60) + + return str(summer_time.days) + ' д ' + h + ' ч ' + m + ' мин ' + s + ' сек' diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..11e7de6 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == "__main__": + app.run() \ No newline at end of file