From 49fd9ac91648d413f4cdbda895e5bd066c3aef98 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 11 Jul 2025 11:57:52 +0300 Subject: [PATCH] =?UTF-8?q?=20=D1=88=D0=B0=D0=BF=D0=BA=D0=B5=20=D0=B2?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D0=BF=D1=80=D0=B8=D0=B2=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=82=D0=B2=D0=B8=D1=8F=20=D1=82=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D0=BA=D1=80=D1=83=D0=BF=D0=BD=D0=BE=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D1=83=D1=89=D0=B5=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D1=8F,=20=D0=B4=D0=B0=D1=82=D0=B0=20=D0=BD=D0=B0=20=D1=80?= =?UTF-8?q?=D1=83=D1=81=D1=81=D0=BA=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + main.py | 11 +++++++++-- templates/index.html | 7 ++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 7b5526b..695bb37 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ - Встроен Monaco Editor для YAML с подсветкой синтаксиса, проверкой ошибок и возможностью увеличивать окно редактора - Добавлен вывод температуры и облачности с weatherapi.com, настройки (api_key, lat, lon, cache_ttl) вынесены в config.yaml - Поддержка настройки времени кэширования погоды через weather.cache_ttl (минуты, по умолчанию 60) +- В шапке вместо приветствия теперь крупно текущее время, дата на русском ## [init] Стартовая инициализация структуры Flask-приложения - Создана структура каталогов: templates/, static/ diff --git a/main.py b/main.py index a5cb7f4..ce40e9b 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ from datetime import datetime import os import requests import time +import locale app = Flask(__name__) @@ -81,9 +82,15 @@ config = load_config() @app.route('/') def index(): - now = datetime.now().strftime('%A, %d %B %Y - %H:%M:%S') + try: + locale.setlocale(locale.LC_TIME, 'ru_RU.UTF-8') + except: + pass + now = datetime.now() + now_str = now.strftime('%A, %d %B %Y').capitalize() + current_time = now.strftime('%H:%M:%S') weather = get_weather() - return render_template('index.html', applications=config['applications'], bookmarks=config['bookmarks'], now=now, weather=weather) + return render_template('index.html', applications=config['applications'], bookmarks=config['bookmarks'], now=now_str, current_time=current_time, weather=weather) if __name__ == '__main__': app.run(debug=True, host='0.0.0.0') diff --git a/templates/index.html b/templates/index.html index 3218c82..3871d56 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,10 +15,11 @@
-

{{ now }}

- Go to Settings -

Good morning!

+
+ {{ current_time }} + {{ now }} +