
- Implement Todo CRUD API endpoints - Set up SQLite database with SQLAlchemy - Create Todo model and schemas - Configure Alembic migrations - Add comprehensive documentation 🤖 Generated with and Co-Authored by [BackendIM](https://backend.im)
17 lines
463 B
Python
17 lines
463 B
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from app.core.config import settings
|
|
|
|
# Create DB directory
|
|
DB_DIR = settings.BASE_DIR / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
engine = create_engine(
|
|
SQLALCHEMY_DATABASE_URL,
|
|
connect_args={"check_same_thread": False}
|
|
)
|
|
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) |