load dotenv everywhere it's needed; postgresql pool pre ping
This commit is contained in:
@@ -18,5 +18,9 @@ elif DATABASE_URL and DATABASE_URL.startswith("postgres+"):
|
||||
if not DATABASE_URL:
|
||||
raise ValueError("DATABASE_URL environment variable is not set or empty.")
|
||||
|
||||
engine = create_engine(DATABASE_URL)
|
||||
engine = create_engine(
|
||||
DATABASE_URL,
|
||||
pool_recycle=3600,
|
||||
pool_pre_ping=True
|
||||
)
|
||||
SessionLocal = sessionmaker(bind=engine)
|
||||
Reference in New Issue
Block a user