Files

105 lines
2.9 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 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