feat: add base FastAPI project structure with static frontend and API v1
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user