29 lines
787 B
Batchfile
29 lines
787 B
Batchfile
|
|
@echo off
|
||
|
|
setlocal
|
||
|
|
cd /d "%~dp0"
|
||
|
|
|
||
|
|
rem Prevent an inherited PYTHONPATH/PYTHONHOME from another application
|
||
|
|
rem (for example Hermes) from loading packages outside this project's .venv.
|
||
|
|
set "PYTHONPATH="
|
||
|
|
set "PYTHONHOME="
|
||
|
|
|
||
|
|
if not exist ".venv\Scripts\python.exe" (
|
||
|
|
echo [ERROR] Virtual environment .venv was not found.
|
||
|
|
echo Create it and install dependencies first:
|
||
|
|
echo py -3.12 -m venv .venv
|
||
|
|
echo .venv\Scripts\python -m pip install fastapi uvicorn pydantic beautifulsoup4 lxml httpx deep-translator markdown bleach trafilatura python-multipart
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
".venv\Scripts\python.exe" main.py
|
||
|
|
set "EXIT_CODE=%ERRORLEVEL%"
|
||
|
|
|
||
|
|
if not "%EXIT_CODE%"=="0" (
|
||
|
|
echo.
|
||
|
|
echo [ERROR] Application stopped with code %EXIT_CODE%.
|
||
|
|
pause
|
||
|
|
)
|
||
|
|
|
||
|
|
exit /b %EXIT_CODE%
|