Skip to content

Commit 10c0181

Browse files
committed
Add provision for .env
1 parent c077d3f commit 10c0181

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/core/database.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from sqlalchemy import create_engine
2+
import os
23
from fastapi import Depends, HTTPException
34
from sqlalchemy.orm import sessionmaker, Session
45
from typing import List, Annotated
56
from sqlalchemy.ext.declarative import declarative_base
67
from sqlalchemy_utils import create_database, database_exists
78
from app.models import Base, Database
9+
import settings
810

9-
DATABASE_URL = 'postgresql://neelxie:password@localhost:5433/ccdatabase'
11+
DATABASE_URL = os.getenv('DATABASE_URI')
1012

1113
if not database_exists(DATABASE_URL):
1214
create_database(DATABASE_URL)

0 commit comments

Comments
 (0)