forked from 2812427914/zion-local-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (24 loc) · 735 Bytes
/
Copy pathrun.py
File metadata and controls
28 lines (24 loc) · 735 Bytes
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
#!/usr/bin/env python3
"""
运行脚本
用于启动Zion本地工具服务
"""
import os
import sys
if __name__ == "__main__":
current_dir = os.path.dirname(os.path.abspath(__file__))
src_dir = os.path.join(current_dir, "src")
if src_dir not in sys.path:
sys.path.insert(0, src_dir)
import uvicorn
from zion_local_tools.config.settings import settings
reload = os.environ.get("ZION_RELOAD", "1") == "1"
workers = 1 if reload else max(1, int(settings.WORKER_COUNT))
uvicorn.run(
"zion_local_tools.main:app",
host=settings.HOST,
port=settings.PORT,
reload=reload,
workers=workers,
limit_concurrency=int(settings.WORKER_LIMIT_CONCURRENCY),
)