Aniworld/start_server.bat

63 lines
1.8 KiB
Batchfile

@echo off
:: AniWorld FastAPI Server Startup Script for Windows
:: This script activates the conda environment and starts the FastAPI server
echo Starting AniWorld FastAPI Server...
echo.
:: Check if conda is available
where conda >nul 2>nul
if %errorlevel% neq 0 (
echo Error: Conda is not available in PATH
echo Please install Anaconda/Miniconda or add conda to your PATH
pause
exit /b 1
)
:: Activate the AniWorld conda environment
echo Activating AniWorld conda environment...
call conda activate AniWorld
if %errorlevel% neq 0 (
echo Error: Failed to activate AniWorld environment
echo Please create the environment first: conda create -n AniWorld python=3.11
pause
exit /b 1
)
:: Check if uvicorn is installed
python -c "import uvicorn" 2>nul
if %errorlevel% neq 0 (
echo Error: uvicorn is not installed
echo Installing FastAPI dependencies...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo Error: Failed to install dependencies
pause
exit /b 1
)
)
:: Set default environment variables if not set
if not defined MASTER_PASSWORD (
echo Warning: MASTER_PASSWORD environment variable is not set
echo You can set it by running: set MASTER_PASSWORD=your_password
echo.
)
:: Start the FastAPI server
echo Starting FastAPI server on http://127.0.0.1:8000
echo Press Ctrl+C to stop the server
echo.
echo Available endpoints:
echo - Web Interface: http://127.0.0.1:8000
echo - API Documentation: http://127.0.0.1:8000/docs
echo - Alternative API Docs: http://127.0.0.1:8000/redoc
echo.
:: Start the server with development settings
python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8000 --reload --log-level info
:: If we get here, the server has stopped
echo.
echo Server stopped.
pause