feat: add base FastAPI project structure with static frontend and API v1

This commit is contained in:
Lino Mallevaey
2025-08-18 00:22:50 +02:00
parent ff5026b8f7
commit 49bcb38261
14 changed files with 487 additions and 13 deletions

View File

@@ -0,0 +1,24 @@
from sqlalchemy.ext.asyncio import create_async_engine, AsyncEngine
from sqlalchemy import create_engine
from app.core.config import settings
# =========================
# SYNCHRONOUS ENGINE
# =========================
# Pour opérations sync classiques
engine = create_engine(
settings.DATABASE_URL.replace("+aiomysql", ""), # remove async part if present
echo=settings.DEBUG,
future=True
)
# =========================
# ASYNCHRONOUS ENGINE
# =========================
# Pour opérations async avec async SQLAlchemy
async_engine: AsyncEngine = create_async_engine(
settings.DATABASE_URL if "+aiomysql" in settings.DATABASE_URL else settings.DATABASE_URL.replace("mysql+pymysql", "mysql+aiomysql"),
echo=settings.DEBUG,
future=True
)