Add Flask/Python backend server

- Create app.py with Flask server on port 5002
- Add requirements.txt with Python dependencies
- Add run_flask.bat for Windows users
- Add run_flask.sh for Linux/Mac users
- Complete Flask setup documentation
- Database integration with PyMySQL
- Full LLM API support (Gemini, DeepSeek, OpenAI, Claude)
- CORS configuration
- Error handling middleware

Features:
 Runs on http://127.0.0.1:5002
 All LLM APIs supported
 Database connection
 API proxy for CORS fix
 Auto setup scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
donald
2025-12-04 00:15:29 +08:00
parent c7b229dc93
commit 763cc7cfdd
5 changed files with 1030 additions and 0 deletions

59
run_flask.bat Normal file
View File

@@ -0,0 +1,59 @@
@echo off
REM Flask 伺服器啟動腳本
echo ========================================
echo HR Performance System - Flask Server
echo ========================================
echo.
REM 檢查 Python 是否安裝
python --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python is not installed or not in PATH
echo Please install Python 3.8 or higher
pause
exit /b 1
)
REM 檢查虛擬環境
if not exist "venv\" (
echo [INFO] Creating virtual environment...
python -m venv venv
if errorlevel 1 (
echo [ERROR] Failed to create virtual environment
pause
exit /b 1
)
echo [SUCCESS] Virtual environment created
echo.
)
REM 啟動虛擬環境
echo [INFO] Activating virtual environment...
call venv\Scripts\activate.bat
REM 安裝依賴
echo [INFO] Installing dependencies...
pip install -r requirements.txt
if errorlevel 1 (
echo [ERROR] Failed to install dependencies
pause
exit /b 1
)
echo.
REM 檢查 .env 檔案
if not exist ".env" (
echo [WARNING] .env file not found
echo Please create .env file with required configuration
echo.
)
REM 啟動 Flask 伺服器
echo [INFO] Starting Flask server...
echo Server will run on http://127.0.0.1:5002
echo Press Ctrl+C to stop the server
echo.
python app.py
pause