forked from LifeArchiveProject/WeChatDataAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (41 loc) · 1.13 KB
/
main.py
File metadata and controls
48 lines (41 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
48
#!/usr/bin/env python3
"""
微信解密工具主启动脚本
使用方法:
uv run main.py
默认在8000端口启动API服务
"""
import uvicorn
import os
from pathlib import Path
def main():
"""启动微信解密工具API服务"""
print("=" * 60)
print("微信解密工具 API 服务")
print("=" * 60)
print("正在启动服务...")
print("API文档: http://localhost:8000/docs")
print("健康检查: http://localhost:8000/api/health")
print("按 Ctrl+C 停止服务")
print("=" * 60)
repo_root = Path(__file__).resolve().parent
enable_reload = os.environ.get("WECHAT_TOOL_RELOAD", "0") == "1"
# 启动API服务
uvicorn.run(
"wechat_decrypt_tool.api:app",
host="0.0.0.0",
port=8000,
reload=enable_reload,
reload_dirs=[str(repo_root / "src")] if enable_reload else None,
reload_excludes=[
"output/*",
"output/**",
"frontend/*",
"frontend/**",
".venv/*",
".venv/**",
] if enable_reload else None,
log_level="info"
)
if __name__ == "__main__":
main()