windows path fix

This commit is contained in:
Dustella 2025-03-20 17:03:16 +08:00
parent e190957405
commit 5408317ee5
Signed by: Dustella
GPG Key ID: 5CC79D823E14C9D1
6 changed files with 51 additions and 4 deletions

3
.gitignore vendored
View File

@ -22,6 +22,9 @@ dist
notebooks
passcode
data
windows
linux
*.7z
*.7z
res
*.txt

View File

@ -1,5 +1,4 @@
import os
import resource
from matplotlib import pyplot as plt
from modules import cosmic
from modules import tidi
@ -77,6 +76,6 @@ if __name__ == '__main__':
env_port = os.getenv("Z_PORT")
port = 5000 if env_port is None else int(env_port)
if 'debug' in args:
app.run("0.0.0.0", port=58620, debug=True)
app.run("0.0.0.0", port=port, debug=True)
else:
app.run("0.0.0.0", port=port, debug=False)

View File

@ -33,7 +33,8 @@ def supermeta():
def list_ballon():
all_ballon_files = glob.glob(
f"{BASE_PATH_BALLOON}/**/**.nc", recursive=True)
# replace all \\ with /
all_ballon_files = [x.replace("\\", "/") for x in all_ballon_files]
return all_ballon_files

View File

@ -16,7 +16,8 @@ tidi_module = Blueprint("Tidi", __name__)
def get_all_years():
res = glob.glob(f"{DATA_BASEPATH.tidi}/**/**.txt", recursive=True)
# search for the folder name that is year
# replace all \\ with /
res = [x.replace("\\", "/") for x in res]
return {
"path": res
}

19
run-linux.sh Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# 询问用户输入端口
read -p "请输入端口号 (默认56800): " port
# 验证端口输入,如果为空或非数字则使用默认值
if [[ -z "$port" ]] || ! [[ "$port" =~ ^[0-9]+$ ]]; then
port=56800
fi
# 设置环境变量
export Z_PORT=$port
# 循环运行程序
while true; do
./linux/backend/backend
echo "程序退出,正在重启..."
sleep 1
done

24
run-windows.bat Normal file
View File

@ -0,0 +1,24 @@
@echo off
set /p "port=Input Port (Default 56800): "
set "numbers=0123456789"
if "%port%"=="" (
set "port=56800"
) else (
set "valid=true"
for /f "delims=%numbers%" %%i in ("%port%") do set "valid=false"
if not "%valid%"=="true" set "port=56800"
)
set Z_PORT=%port%
:loop
.\windows\backend\backend.exe
echo Exit, restart...
timeout /t 1 /nobreak >nul
goto loop