-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstart_web.sh
More file actions
executable file
·72 lines (59 loc) · 1.69 KB
/
start_web.sh
File metadata and controls
executable file
·72 lines (59 loc) · 1.69 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env bash
# start_web.sh
# KGCompass Web 界面快速启动脚本
set -euo pipefail
echo "🚀 启动 KGCompass Web 界面..."
# 检查 Python 版本
python_version=$(python3 --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
echo "📍 Python 版本: $python_version"
# 检查是否存在虚拟环境
if [[ ! -d "venv" ]]; then
echo "🔧 创建虚拟环境..."
python3 -m venv venv
fi
# 激活虚拟环境
echo "🔧 激活虚拟环境..."
source venv/bin/activate
# 安装依赖
echo "📦 安装/更新依赖..."
pip install -r requirements_web.txt
# 创建必要的目录
echo "📁 创建输出目录..."
mkdir -p web_outputs
mkdir -p static/css static/js templates
# 检查必要文件
echo "🔍 检查必要文件..."
required_files=(
"app.py"
"templates/index.html"
"static/css/style.css"
"static/js/app.js"
)
missing_files=()
for file in "${required_files[@]}"; do
if [[ ! -f "$file" ]]; then
missing_files+=("$file")
fi
done
if [[ ${#missing_files[@]} -gt 0 ]]; then
echo "❌ 缺少必要文件:"
printf " - %s\n" "${missing_files[@]}"
echo "请确保所有文件都已创建"
exit 1
fi
# 设置环境变量
export FLASK_APP=app.py
export FLASK_ENV=development
export FLASK_DEBUG=1
echo ""
echo "======================================================"
echo "🎉 KGCompass Web 界面启动完成!"
echo "======================================================"
echo "📡 访问地址: http://localhost:5000"
echo "🔧 开发模式: 已启用"
echo "📊 实时日志: WebSocket 支持"
echo "🛠️ 停止服务: Ctrl+C"
echo "======================================================"
echo ""
# 启动 Flask 应用
python3 app.py