```
docs(README): 更新启动服务文档并添加生产环境部署说明 - 添加了开发环境启动说明 - 新增生产环境 Gunicorn 部署指南 - 包含 Gunicorn 安装和配置参数说明 ```
This commit is contained in:
parent
bd80414c4d
commit
dd140d88d7
12
README.md
12
README.md
@ -28,11 +28,23 @@ pip install -r requirements.txt
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. 启动服务
|
### 2. 启动服务
|
||||||
|
|
||||||
|
**开发环境**
|
||||||
```bash
|
```bash
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
服务默认运行在 `http://127.0.0.1:5000`。
|
服务默认运行在 `http://127.0.0.1:5000`。
|
||||||
|
|
||||||
|
**生产环境 (Gunicorn)**
|
||||||
|
在 Linux 生产环境中,建议使用 Gunicorn 作为 WSGI 服务器以获得更好的性能和稳定性:
|
||||||
|
```bash
|
||||||
|
pip install gunicorn # 如果尚未安装
|
||||||
|
gunicorn -w 4 -b 0.0.0.0:5000 app:app
|
||||||
|
```
|
||||||
|
* `-w 4`: 使用 4 个工作进程(通常设为 CPU 核心数 * 2 + 1)。
|
||||||
|
* `-b 0.0.0.0:5000`: 绑定所有 IP 且端口为 5000。
|
||||||
|
* `app:app`: 加载 `app.py` 中的 `app` 实例。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🛠️ 常用维护命令
|
## 🛠️ 常用维护命令
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Loading…
Reference in New Issue
Block a user