Automated Action 9586f0c506 Fix Pydantic error by moving DB_DIR outside of Settings class
- Moved DB_DIR Path definition outside Settings class to fix Pydantic 2.x annotation error
- Updated path to use project-specific path rather than /app
- Added start.py script to validate app loading

generated with BackendIM... (backend.im)
2025-05-13 23:34:58 +00:00

19 lines
438 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
SQLALCHEMY_DATABASE_URL = settings.DATABASE_URL
engine = create_engine(
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()