🔧 백엔드 데이터베이스 연결 설정 수정
- localhost에서 postgres 컨테이너명으로 변경 - Docker 환경에서 컨테이너 간 통신 가능하도록 개선 - 환경변수를 통한 DATABASE_URL 오버라이드 지원
This commit is contained in:
@@ -3,8 +3,11 @@ from sqlalchemy.ext.declarative import declarative_base
|
|||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# 데이터베이스 URL
|
# 데이터베이스 URL (환경변수에서 읽거나 기본값 사용)
|
||||||
DATABASE_URL = "postgresql://tkmp_user:tkmp_password_2025@localhost:5432/tk_mp_bom"
|
DATABASE_URL = os.getenv(
|
||||||
|
"DATABASE_URL",
|
||||||
|
"postgresql://tkmp_user:tkmp_password_2025@postgres:5432/tk_mp_bom"
|
||||||
|
)
|
||||||
|
|
||||||
# SQLAlchemy 엔진 생성
|
# SQLAlchemy 엔진 생성
|
||||||
engine = create_engine(DATABASE_URL)
|
engine = create_engine(DATABASE_URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user