aymie-oh commited on
Commit
40113d9
·
1 Parent(s): 39ef4f8
Files changed (1) hide show
  1. src/app/app.py +5 -4
src/app/app.py CHANGED
@@ -17,11 +17,12 @@ DATABASE_URL = os.getenv("DATABASE_URL")
17
  if DATABASE_URL and DATABASE_URL.startswith("postgres://"):
18
  DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql+asyncpg://", 1)
19
 
20
- if DATABASE_URL:
21
- engine = create_async_engine(DATABASE_URL, echo=True)
22
  else:
23
- log.warning("DATABASE_URL not found. Database features will be unavailable.")TABASE_URL.replace("postgres://", "postgresql+asyncpg://", 1)
24
-
 
25
  @asynccontextmanager
26
  async def lifespan(app: FastAPI):
27
  print("Starting up...")
 
17
  if DATABASE_URL and DATABASE_URL.startswith("postgres://"):
18
  DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql+asyncpg://", 1)
19
 
20
+ if not DATABASE_URL:
21
+ log.warning("DATABASE_URL not found. Database features will be unavailable.")
22
  else:
23
+ if DATABASE_URL.startswith("postgres://"):
24
+ DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql+asyncpg://", 1)
25
+
26
  @asynccontextmanager
27
  async def lifespan(app: FastAPI):
28
  print("Starting up...")