API Users wit Cookies

Sorry for the wrong branch
This commit is contained in:
Rudi committed 2026-08-28 15:39:59 +02:00
1 parent 8b70ed1550
commit a36749d788
15 files changed
+494 -2

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
# database.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base
DATABASE_URL = "sqlite:///./tandur.db" # Datei landet im Projektordner
engine = create_engine(
DATABASE_URL,
connect_args={"check_same_thread": False} # nötig für SQLite + FastAPI
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()