docs: 리눅스 기준 접속 방법 안내 및 환경 변수 기반 포트 설정 기능 추가

This commit is contained in:
leeyj
2026-04-20 00:40:50 +09:00
parent ff9d75c26f
commit 379f7eb0c4
4 changed files with 73 additions and 5 deletions
+18 -5
View File
@@ -7,14 +7,27 @@ from app import create_app
app = create_app()
if __name__ == "__main__":
# OS 환경에 따른 설정 분기
# 1. OS 환경에 따른 기본값 설정
is_windows = platform.system() == "Windows"
default_port = 5050 if is_windows else 5093
default_debug = True if is_windows else False
# Windows(개발/디버그): 5050 포트, Linux(운영): 5093 포트
port = 5050 if is_windows else 5093
debug_mode = True if is_windows else False
# 2. 환경 변수 우선 적용 (PORT)
try:
env_port = os.getenv("PORT")
port = int(env_port) if env_port else default_port
except (ValueError, TypeError):
port = default_port
# 3. 환경 변수 우선 적용 (DEBUG)
env_debug = os.getenv("DEBUG")
if env_debug is not None:
debug_mode = env_debug.lower() == "true"
else:
debug_mode = default_debug
print(f"📡 {'Windows' if is_windows else 'Linux'} 환경 감지 - Port: {port}, Debug: {debug_mode}")
print(f"📡 {'Windows' if is_windows else 'Linux'} 환경 감지")
print(f"⚙️ 설정 적용 - Port: {port}, Debug: {debug_mode}")
# 향후 Linux 서버 구축시 gunicorn / uwsgi 로 구동 권장
app.run(host="0.0.0.0", port=port, debug=debug_mode)