本仓库包含:
thesis_frontend:前端(Vue 3 + Vite)cfms_on_websocket-master:后端(以 Git Submodule 方式引入)
- Git 2.30+
- Node.js 18+(建议 20 LTS)
- Python 3.13+
- Windows PowerShell(本文命令以 PowerShell 为例)
git clone <你的仓库地址>
Set-Location <仓库目录>
git submodule update --init --recursive如果后端子模块有更新,拉取主仓库后执行:
git submodule update --init --recursiveSet-Location .\cfms_on_websocket-master\src
# 首次生成配置文件
if (-not (Test-Path "config.toml")) {
Copy-Item "config.toml.sample" "config.toml"
}
# 准备运行目录
New-Item -ItemType Directory -Path "content\logs" -Force | Out-Null
New-Item -ItemType Directory -Path "content\ssl" -Force | Out-Null
# 启动后端
python.exe main.py默认监听地址与端口(见 config.toml):
- Host:
localhost - Port:
5104 - 协议:
wss
Set-Location ..\..\thesis_frontend
npm install
npm run dev常用命令:
npm run build
npm run preview- 前端默认连接地址:
wss://localhost:5104 - 若使用自签名证书,浏览器可能提示证书不受信任,需要先手动信任证书后再连接
- 后端目录为空
- 原因:未初始化子模块
- 处理:
git submodule update --init --recursive
- 前端连接失败
- 先确认后端是否已启动
- 再确认
config.toml的 host/port 与前端连接地址一致 - 检查证书是否已被系统/浏览器信任