105 lines
2.9 KiB
Batchfile
105 lines
2.9 KiB
Batchfile
@echo off
|
||
REM BDFR Web Interface Startup Script for Windows
|
||
REM This script provides an easy way to start the BDFR web interface on Windows
|
||
|
||
setlocal enabledelayedexpansion
|
||
|
||
REM Colors for output (Windows 10+)
|
||
set "RED=[91m"
|
||
set "GREEN=[92m"
|
||
set "YELLOW=[93m"
|
||
set "BLUE=[94m"
|
||
set "NC=[0m"
|
||
|
||
REM Function to print colored output (simplified for Windows)
|
||
echo 🌟 BDFR Web Interface Startup
|
||
echo ==================================================
|
||
|
||
REM Check if we're in the right directory
|
||
if not exist "requirements.txt" (
|
||
echo ❌ Error: Please run this script from the web_interface directory
|
||
echo Usage: start.bat
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
if not exist "app" (
|
||
echo ❌ Error: app directory not found
|
||
echo Please make sure you're in the web_interface directory
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo ℹ️ Checking Python version...
|
||
|
||
REM Check Python version
|
||
python --version > temp_python_version.txt 2>&1
|
||
set /p PYTHON_VERSION=<temp_python_version.txt
|
||
del temp_python_version.txt
|
||
|
||
echo ✅ Python version: %PYTHON_VERSION%
|
||
|
||
REM Check if Python 3.8+ is available (simplified check)
|
||
echo %PYTHON_VERSION% | findstr /C:"Python 3." >nul
|
||
if errorlevel 1 (
|
||
echo ❌ Error: Python 3 is required
|
||
echo Current version: %PYTHON_VERSION%
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
REM Install dependencies
|
||
echo ℹ️ Checking and installing dependencies...
|
||
if exist requirements.txt (
|
||
echo ℹ️ Installing Python dependencies...
|
||
python -m pip install -r requirements.txt
|
||
if !errorlevel! neq 0 (
|
||
echo ❌ Failed to install dependencies
|
||
pause
|
||
exit /b 1
|
||
)
|
||
echo ✅ Dependencies installed successfully
|
||
) else (
|
||
echo ❌ requirements.txt not found
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
REM Check if BDFR module is available
|
||
echo ℹ️ Checking BDFR module availability...
|
||
python -c "import sys; sys.path.insert(0, '../bdfr'); import bdfr.api; print('BDFR API imported successfully')" >nul 2>&1
|
||
if !errorlevel! neq 0 (
|
||
echo ⚠️ Warning: BDFR module not found in Python path
|
||
echo Make sure the parent directory is in your Python path
|
||
echo Or run this script from the project root directory
|
||
echo Attempting to install BDFR...
|
||
cd ..
|
||
python -m pip install -e .
|
||
cd web_interface
|
||
if !errorlevel! neq 0 (
|
||
echo ❌ Failed to install BDFR
|
||
pause
|
||
exit /b 1
|
||
)
|
||
echo ✅ BDFR installed successfully
|
||
) else (
|
||
echo ✅ BDFR module found
|
||
)
|
||
|
||
REM Start the server
|
||
echo.
|
||
echo ==================================================
|
||
echo ℹ️ Starting BDFR Web Interface...
|
||
echo ℹ️ Server will be available at: http://localhost:8000
|
||
echo ℹ️ API documentation at: http://localhost:8000/docs
|
||
echo ℹ️ Press Ctrl+C to stop the server
|
||
echo ==================================================
|
||
|
||
REM Start uvicorn server
|
||
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||
|
||
REM This code runs when the server is stopped
|
||
echo.
|
||
echo ℹ️ BDFR Web Interface stopped
|
||
|
||
pause |