maj via codex

This commit is contained in:
2026-02-22 18:34:50 +01:00
parent 20af00d653
commit 55387f4b0e
90 changed files with 9902 additions and 1251 deletions

View File

@@ -4,7 +4,7 @@ from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.config import CORS_ORIGINS, UPLOAD_DIR
from app.config import CORS_ORIGINS, ENABLE_BOOTSTRAP, ENABLE_SCHEDULER, UPLOAD_DIR
from app.database import create_db_and_tables
@@ -15,19 +15,20 @@ async def lifespan(app: FastAPI):
os.makedirs("/data/skyfield", exist_ok=True)
except OSError:
pass
import app.models # noqa — enregistre tous les modèles avant create_all
from app.migrate import run_migrations
run_migrations()
create_db_and_tables()
from app.seed import run_seed
run_seed()
# Démarrer le scheduler météo
from app.services.scheduler import setup_scheduler
setup_scheduler()
if ENABLE_BOOTSTRAP:
import app.models # noqa — enregistre tous les modèles avant create_all
from app.migrate import run_migrations
run_migrations()
create_db_and_tables()
from app.seed import run_seed
run_seed()
if ENABLE_SCHEDULER:
from app.services.scheduler import setup_scheduler
setup_scheduler()
yield
# Arrêter le scheduler
from app.services.scheduler import scheduler
scheduler.shutdown(wait=False)
if ENABLE_BOOTSTRAP and ENABLE_SCHEDULER:
from app.services.scheduler import scheduler
scheduler.shutdown(wait=False)
app = FastAPI(title="Jardin API", lifespan=lifespan)