modified: README.md
new file: app.py new file: config/config.toml new file: requirements.txt new file: run.bat new file: run.sh new file: src/__init__.py new file: src/file_store_api.py new file: src/mainprocess.py new file: src/modules/__init__.py new file: src/modules/plugin_modules.py new file: src/modules/user_modules.py new file: src/plugin_manager.py
This commit is contained in:
74
run.bat
Normal file
74
run.bat
Normal file
@ -0,0 +1,74 @@
|
||||
@echo off
|
||||
|
||||
|
||||
set PROJECT_DIR=%~dp0
|
||||
set VENV_DIR=%PROJECT_DIR%.venv
|
||||
|
||||
|
||||
if exist "%VENV_DIR%\Scripts\activate.bat" (
|
||||
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
) else (
|
||||
|
||||
python -m venv "%VENV_DIR%"
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo error: fail to create env
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if "%VIRTUAL_ENV%" == "" (
|
||||
echo error: fail to activate env
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo installing dependence...
|
||||
|
||||
pip install -r requirements.txt
|
||||
if errorlevel 1 (
|
||||
echo error: fail to install dependence
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pip install waitress
|
||||
if errorlevel 1 (
|
||||
echo error: fail to install waitress
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
|
||||
echo reading port from config...
|
||||
for /f "usebackq tokens=*" %%P in (`python -c "from src.file_store_api import ConfigManager; config=ConfigManager().load_config(); print(config.get('app', {}).get('list_port', 25580))"`) do (
|
||||
set PORT=%%P
|
||||
)
|
||||
|
||||
|
||||
if "%PORT%"=="" (
|
||||
set PORT=25580
|
||||
echo can't read port,use custom port:25580
|
||||
) else (
|
||||
echo success read port: %PORT%
|
||||
)
|
||||
|
||||
:: 5. 启动服务
|
||||
echo starting rebot_server...
|
||||
echo listening at: %PORT%
|
||||
|
||||
:: 正确启动 waitress
|
||||
waitress-serve --host=0.0.0.0 --port=%PORT% app:app
|
||||
|
||||
:: 6. 错误处理
|
||||
if errorlevel 1 (
|
||||
echo error,fail to start
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
pause
|
Reference in New Issue
Block a user