Update 2025-12-19 16:23:03

This commit is contained in:
unknown
2025-12-19 16:23:03 +09:00
parent 804204ab97
commit b18412ecb2
30 changed files with 6607 additions and 1165 deletions

10
app.py
View File

@@ -151,8 +151,12 @@ def start_telegram_bot_polling() -> None:
# ─────────────────────────────────────────────────────────────
# 텔레그램 봇 폴링 자동 시작
# Flask 앱이 초기화되면 자동으로 봇 폴링 시작
# 주의: Flask 리로더(Debug 모드) 사용 시 메인/워커 프로세스 중복 실행 방지
# ─────────────────────────────────────────────────────────────
start_telegram_bot_polling()
# 1. 리로더의 워커 프로세스인 경우 (WERKZEUG_RUN_MAIN = "true")
# 2. 또는 디버그 모드가 꺼진 경우 (Production)
if os.environ.get("WERKZEUG_RUN_MAIN") == "true" or not app.config.get("DEBUG"):
start_telegram_bot_polling()
# ─────────────────────────────────────────────────────────────
@@ -162,5 +166,9 @@ if __name__ == "__main__":
host = os.getenv("FLASK_HOST", "0.0.0.0")
port = int(os.getenv("FLASK_PORT", 5000))
debug = os.getenv("FLASK_DEBUG", "true").lower() == "true"
# python app.py로 직접 실행 시(use_reloader=False)에는 위 조건문에서 실행되지 않을 수 있으므로
# 여기서 명시적으로 실행 (중복 실행 방지 플래그가 있어 안전함)
start_telegram_bot_polling()
socketio.run(app, host=host, port=port, debug=debug, allow_unsafe_werkzeug=True, use_reloader=False)