Files
Document_Translator/start_dev.bat
beabigegg b11a8272c4 2ND
2025-09-02 13:11:48 +08:00

65 lines
1.7 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
REM PANJIT Document Translator - 開發環境啟動腳本
echo ========================================
echo 啟動 PANJIT Document Translator 開發環境
echo ========================================
REM 檢查虛擬環境
if not exist "venv\Scripts\activate.bat" (
echo 建立虛擬環境...
python -m venv venv
)
REM 啟動虛擬環境
echo 啟動虛擬環境...
call venv\Scripts\activate.bat
REM 安裝依賴
echo 安裝/更新依賴套件...
pip install -r requirements.txt
REM 複製環境變數檔案(如果不存在)
if not exist ".env" (
echo 複製環境變數範本...
copy .env.example .env
echo 請編輯 .env 檔案設定您的環境變數
pause
)
REM 建立必要目錄
echo 建立必要目錄...
if not exist "uploads" mkdir uploads
if not exist "logs" mkdir logs
REM 檢查 Redis 是否運行Windows
echo 檢查 Redis 服務...
sc query Redis > nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo 警告: Redis 服務未運行。請確保 Redis 已安裝並運行。
echo 您可以從 https://redis.io/download 下載 Redis
)
REM 啟動 Celery Worker後台
echo 啟動 Celery Worker...
start "Celery Worker" cmd /c "venv\Scripts\python.exe -m celery -A app.celery worker --loglevel=info --pool=solo"
REM 等待一下讓 Celery 啟動
timeout /t 3 /nobreak > nul
REM 啟動 Flask 應用
echo 啟動 Flask 應用程式...
echo.
echo ========================================
echo 系統啟動完成!
echo Flask 應用: http://127.0.0.1:5000
echo API 文檔: http://127.0.0.1:5000/api
echo 健康檢查: http://127.0.0.1:5000/api/v1/health
echo.
echo 按 Ctrl+C 停止伺服器
echo ========================================
echo.
python app.py
pause