fix empty base on 1st start
All checks were successful
Test Build / test-build (push) Successful in 1s
All checks were successful
Test Build / test-build (push) Successful in 1s
This commit is contained in:
4
app.py
4
app.py
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
from flask import Flask, session, request
|
||||
from sqlalchemy import inspect
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# 1. Загрузка переменных окружения - в самом верху
|
||||
@@ -62,6 +63,7 @@ def create_app():
|
||||
login_manager.login_message_category = "info"
|
||||
|
||||
with app.app_context():
|
||||
if inspect(db.engine).has_table('user_config'):
|
||||
from models import User, UserConfig
|
||||
all_configs = UserConfig.query.all()
|
||||
for config in all_configs:
|
||||
@@ -82,6 +84,8 @@ def create_app():
|
||||
app.logger.info(f"Job {job_id} loaded on startup.")
|
||||
except Exception as e:
|
||||
app.logger.error(f"Failed to load job {job_id}: {e}")
|
||||
else:
|
||||
app.logger.warning("Database tables not found. Skipping job loading on startup. Run 'flask init-db' to create the tables.")
|
||||
scheduler.start()
|
||||
|
||||
# --- Регистрация команд CLI ---
|
||||
|
||||
Reference in New Issue
Block a user