mirror of
https://github.com/sstent/FitTrack_ReportGenerator.git
synced 2026-03-16 09:55:53 +00:00
sync
This commit is contained in:
@@ -3,15 +3,18 @@ from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
import os
|
||||
|
||||
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://user:password@localhost/fittrack")
|
||||
DATABASE_URL = os.getenv(
|
||||
"DATABASE_URL", "sqlite:///./test.db"
|
||||
)
|
||||
|
||||
engine = create_engine(DATABASE_URL)
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
def get_db():
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
db.close()
|
||||
|
||||
Reference in New Issue
Block a user