배포
This commit is contained in:
commit
d9ef64eafe
35 files changed
+4733
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import uvicorn
|
||||
from backend.app.config import settings
|
||||
|
||||
def start_api():
|
||||
uvicorn.run("backend.app.main:app", host=settings.API_HOST, port=settings.API_PORT, log_level="info")
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 인자로 --window 또는 -w 가 전달되면 pywebview 창으로 실행
|
||||
if "--window" in sys.argv or "-w" in sys.argv:
|
||||
try:
|
||||
import webview
|
||||
server_thread = threading.Thread(target=start_api, daemon=True)
|
||||
server_thread.start()
|
||||
time.sleep(1) # 서버 구동 대기
|
||||
webview.create_window('Transmission Magnet Manager', f'http://127.0.0.1:{settings.API_PORT}')
|
||||
webview.start()
|
||||
except ImportError:
|
||||
print("pywebview가 설치되어 있지 않습니다. 웹 서버 모드로 실행합니다.")
|
||||
start_api()
|
||||
else:
|
||||
# 기본: FastAPI 웹 애플리케이션 실행
|
||||
print(f"==================================================")
|
||||
print(f" 🧲 Transmission Magnet Manager")
|
||||
print(f" 접속 주소: http://localhost:{settings.API_PORT}")
|
||||
print(f" 창 모드 실행: python main.py --window")
|
||||
print(f"==================================================")
|
||||
start_api()
|
||||
Reference in new issue
Block a user