@echo off echo ==================================== echo Body Balance Evaluation System - Debug Mode echo ==================================== echo. :: Check Python python --version >nul 2>&1 if %errorlevel% neq 0 ( echo [Error] Python not found, please install Python 3.8 or higher pause exit /b 1 ) :: Show version info echo [Info] Checking environment versions... for /f "tokens=*" %%i in ('python --version') do echo Python: %%i echo. :: Check virtual environment if not exist "backend\venv" ( echo [Info] Creating Python virtual environment... python -m venv backend\venv if %errorlevel% neq 0 ( echo [Error] Failed to create virtual environment pause exit /b 1 ) ) :: Activate virtual environment echo [Info] Activating virtual environment... call backend\venv\Scripts\activate.bat if %errorlevel% neq 0 ( echo [Error] Failed to activate virtual environment pause exit /b 1 ) :: Install Python dependencies echo [Info] Checking and installing Python dependencies... if not exist "backend\requirements.txt" ( echo [Error] requirements.txt file not found pause exit /b 1 ) pip install -r backend\requirements.txt if %errorlevel% neq 0 ( echo [Error] Failed to install Python dependencies pause exit /b 1 ) :: Create necessary directories echo [Info] Creating necessary directories... if not exist "data" mkdir data if not exist "data\patients" mkdir data\patients if not exist "data\sessions" mkdir data\sessions if not exist "data\exports" mkdir data\exports if not exist "data\backups" mkdir data\backups if not exist "logs" mkdir logs if not exist "temp" mkdir temp :: Start application in debug mode echo. echo ==================================== echo Starting Debug Mode echo ==================================== echo [Info] Starting backend server in debug mode... echo [Info] Backend address: http://127.0.0.1:5000 echo [Info] Debug mode enabled - you can set breakpoints in your IDE echo [Info] Press Ctrl+C to stop service echo. echo [Debug Tips]: echo 1. Open your IDE (VS Code, PyCharm, etc.) echo 2. Set breakpoints in backend\app.py or other Python files echo 3. Attach debugger to the running process if needed echo 4. Use browser dev tools for frontend debugging echo. :: Set environment variables for debugging set FLASK_ENV=development set FLASK_DEBUG=1 set PYTHONPATH=%cd% :: Start main program with debug flags python -u backend\app.py if %errorlevel% neq 0 ( echo. echo [Error] Application startup failed echo [Tip] Please check error messages and fix issues pause exit /b 1 ) echo. echo [Info] Debug session ended pause