-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathrun_webui.py
More file actions
44 lines (35 loc) · 1.05 KB
/
run_webui.py
File metadata and controls
44 lines (35 loc) · 1.05 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
FactorMiner WebUI 启动脚本
"""
import sys
import os
from pathlib import Path
# 禁用Flask文件监控,避免因factorlib文件更新而重启
os.environ['FLASK_ENV'] = 'development'
# 添加项目根目录到路径
project_root = Path(__file__).parent
sys.path.append(str(project_root))
from webui.app import app
from config import WEBUI_CONFIG
def main():
"""启动WebUI"""
print("=== FactorMiner WebUI 启动 ===")
print(f"访问地址: http://{WEBUI_CONFIG['host']}:{WEBUI_CONFIG['port']}")
print(f"调试模式: {'开启' if WEBUI_CONFIG['debug'] else '关闭'}")
print("按 Ctrl+C 停止服务")
print()
try:
app.run(
host=WEBUI_CONFIG['host'],
port=WEBUI_CONFIG['port'],
debug=WEBUI_CONFIG['debug'],
use_reloader=False # 禁用自动重载
)
except KeyboardInterrupt:
print("\n服务已停止")
except Exception as e:
print(f"启动失败: {e}")
if __name__ == "__main__":
main()