bind 0.0.0.0
This commit is contained in:
@@ -11,7 +11,8 @@ pip install -r requirements.txt
|
||||
python3 -m app
|
||||
```
|
||||
|
||||
浏览器打开 http://127.0.0.1:8765
|
||||
浏览器打开 http://服务器IP:8765 (本机也可用 http://127.0.0.1:8765)
|
||||
服务默认监听 `0.0.0.0:8765`。可用环境变量覆盖:`HOST=127.0.0.1 PORT=8765 ./run.sh`
|
||||
|
||||
默认账号:`admin` / `hangbiao2026`(请在 `app/config.py` 修改)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import uvicorn
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(
|
||||
"app.main:app",
|
||||
host="127.0.0.1",
|
||||
host=os.environ.get("HOST", "0.0.0.0"),
|
||||
port=int(os.environ.get("PORT", "8765")),
|
||||
reload=os.environ.get("RELOAD", "1") != "0",
|
||||
reload=os.environ.get("RELOAD", "0") != "0",
|
||||
)
|
||||
|
||||
5
run.sh
5
run.sh
@@ -1,8 +1,11 @@
|
||||
#!/bin/zsh
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
if [ ! -x .venv/bin/python ]; then
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
fi
|
||||
export HOST="${HOST:-0.0.0.0}"
|
||||
export PORT="${PORT:-8765}"
|
||||
export RELOAD="${RELOAD:-0}"
|
||||
exec .venv/bin/python -m app
|
||||
|
||||
Reference in New Issue
Block a user