46 lines
1.1 KiB
Batchfile
46 lines
1.1 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions DisableDelayedExpansion
|
|
|
|
for %%I in ("%~dp0..") do set "REPO_ROOT=%%~fI"
|
|
title SystemSimulationApp FastAPI - 127.0.0.1:8000
|
|
|
|
set "PYTHON_EXE=%REPO_ROOT%\.venv-win\Scripts\python.exe"
|
|
if not defined SIMULATION_NUMERIC_ENGINE set "SIMULATION_NUMERIC_ENGINE=native"
|
|
|
|
if not exist "%PYTHON_EXE%" (
|
|
echo [ERROR] Python virtual environment was not found:
|
|
echo %PYTHON_EXE%
|
|
echo.
|
|
echo Create it and install the backend dependencies first:
|
|
echo py -3 -m venv "%REPO_ROOT%\.venv-win"
|
|
echo "%PYTHON_EXE%" -m pip install -r "%REPO_ROOT%\requirements.txt"
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
pushd "%REPO_ROOT%" >nul
|
|
if errorlevel 1 (
|
|
echo [ERROR] Unable to enter the repository directory:
|
|
echo %REPO_ROOT%
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Starting FastAPI at http://127.0.0.1:8000
|
|
echo Press Ctrl+C to stop the service.
|
|
echo.
|
|
|
|
"%PYTHON_EXE%" -m uvicorn app.main:app --host 127.0.0.1 --port 8000
|
|
set "EXIT_CODE=%ERRORLEVEL%"
|
|
|
|
if not "%EXIT_CODE%"=="0" (
|
|
echo.
|
|
echo [ERROR] FastAPI exited with code %EXIT_CODE%.
|
|
pause
|
|
)
|
|
|
|
popd
|
|
exit /b %EXIT_CODE%
|