1. 修改了应用端口的问题

2. 增加了创建虚拟环境的脚本和删除虚拟环境的脚本
This commit is contained in:
2026-01-26 14:33:00 +08:00
parent 730ac6f460
commit 40ca89fad5
23 changed files with 714 additions and 40 deletions

View File

@@ -13,6 +13,18 @@ echo ""
# 获取本机IP地址
SERVER_IP=$(hostname -I | awk '{print $1}')
# 从 config.yaml 读取端口配置
CONFIG_FILE="$SCRIPT_DIR/../config.yaml"
if [ -f "$CONFIG_FILE" ]; then
# 使用 python 读取 yaml 文件
WEB_PORT=$(python3 -c "import yaml; print(yaml.safe_load(open('$CONFIG_FILE'))['app'].get('web_port', 7862))" 2>/dev/null)
if [ -z "$WEB_PORT" ]; then
WEB_PORT=7862
fi
else
WEB_PORT=7862
fi
echo "请选择启动方式:"
echo "1) 直接打开文件(本地访问)"
echo "2) 启动HTTP服务器可通过IP访问"
@@ -63,15 +75,15 @@ case $choice in
fi
echo "📱 访问地址:"
echo " - 主页: http://$SERVER_IP:8000/pages/main.html"
echo " - 登录: http://$SERVER_IP:8000/pages/login.html"
echo " - 主页: http://$SERVER_IP:$WEB_PORT/pages/main.html"
echo " - 登录: http://$SERVER_IP:$WEB_PORT/pages/login.html"
echo ""
echo "⚠️ 服务器将在端口 8000 启动"
echo "⚠️ 服务器将在端口 $WEB_PORT 启动"
echo "按 Ctrl+C 停止服务器"
echo ""
# 启动HTTP服务器
$PYTHON_CMD -m http.server 8000
$PYTHON_CMD -m http.server $WEB_PORT
;;
*)
@@ -79,4 +91,3 @@ case $choice in
exit 1
;;
esac