-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev-start.sh
More file actions
47 lines (36 loc) · 1.13 KB
/
dev-start.sh
File metadata and controls
47 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# 网络调试助手开发测试脚本
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}🧪 启动网络调试助手开发服务${NC}"
# 项目目录
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_DIR="$PROJECT_DIR/backend"
# 检查Python依赖
echo -e "${YELLOW}📋 检查Python依赖...${NC}"
cd "$BACKEND_DIR"
if ! python3 -c "import fastapi" &> /dev/null; then
echo -e "${YELLOW}📦 安装Python依赖...${NC}"
pip3 install -r requirements.txt
fi
echo -e "${GREEN}✅ 依赖检查完成${NC}"
# 检查前端构建文件
if [ ! -d "$BACKEND_DIR/static" ]; then
echo -e "${YELLOW}🏗️ 前端未构建,正在构建...${NC}"
cd "$PROJECT_DIR/front"
npm run build
echo -e "${GREEN}✅ 前端构建完成${NC}"
fi
# 启动后端服务
cd "$BACKEND_DIR"
echo -e "${BLUE}🚀 启动服务...${NC}"
echo -e "${GREEN}🌐 Web界面: http://localhost:20001${NC}"
echo -e "${GREEN}📚 API文档: http://localhost:20001/docs${NC}"
echo -e "${YELLOW}按 Ctrl+C 停止服务${NC}"
echo ""
python3 main.py