Automated Action 86a4793cce Enhance FastAPI application setup
- Added environment variable support via .env file
- Updated API routes with versioning prefix
- Improved documentation in README
- Enhanced SQLite database path configuration

generated with BackendIM... (backend.im)
2025-05-13 10:15:27 +00:00

18 lines
399 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(
settings.SQLALCHEMY_DATABASE_URL,
connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()