forked from XuJiachengZust/codeAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_server.py
More file actions
44 lines (36 loc) · 1.04 KB
/
Copy pathrun_server.py
File metadata and controls
44 lines (36 loc) · 1.04 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
"""
Java代码分析工具服务器启动脚本
"""
import os
import sys
import uvicorn
from pathlib import Path
# 添加项目根目录到Python路径
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
from config.settings import Settings
def main():
"""启动服务器"""
settings = Settings()
print(f"启动 {settings.app_name} v{settings.app_version}")
print(f"服务地址: http://{settings.host}:{settings.port}")
print(f"API文档: http://{settings.host}:{settings.port}/docs")
print(f"Neo4j连接: {settings.neo4j_uri}")
print("=" * 50)
# 启动服务器
try:
uvicorn.run(
"main:app",
host=settings.host,
port=settings.port,
reload=settings.debug,
log_level=settings.log_level.lower()
)
except KeyboardInterrupt:
print("\n服务器已停止")
except Exception as e:
print(f"启动服务器时出错: {e}")
sys.exit(1)
if __name__ == "__main__":
main()