fix port
This commit is contained in:
parent
f5561f4fa9
commit
7f667f4dc2
7
app.py
7
app.py
@ -171,4 +171,11 @@ async def shutdown_event():
|
||||
if __name__ == '__main__':
|
||||
import uvicorn
|
||||
port = os.getenv("XHS_API_PORT", 5005)
|
||||
# 不是数字的话转为 int
|
||||
try:
|
||||
port = int(port)
|
||||
except ValueError:
|
||||
print(f"Invalid port number: {port}. Using default port 5005.")
|
||||
port = 5005
|
||||
# 启动 FastAPI 应用
|
||||
uvicorn.run(app, host="0.0.0.0", port=port)
|
Loading…
x
Reference in New Issue
Block a user