From dd140d88d714f56bd9832e0c451fe3efd0affa3c Mon Sep 17 00:00:00 2001 From: 24024 <240241002@qq.com> Date: Sun, 15 Feb 2026 10:07:38 +0800 Subject: [PATCH] =?UTF-8?q?```=20docs(README):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1=E6=96=87=E6=A1=A3=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加了开发环境启动说明 - 新增生产环境 Gunicorn 部署指南 - 包含 Gunicorn 安装和配置参数说明 ``` --- README.md | 12 ++++++++++++ requirements.txt | Bin 2118 -> 2156 bytes 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 71dc125..a81ed41 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,23 @@ pip install -r requirements.txt ``` ### 2. 启动服务 + +**开发环境** ```bash python app.py ``` 服务默认运行在 `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` 实例。 + --- ## 🛠️ 常用维护命令 diff --git a/requirements.txt b/requirements.txt index 8b2ee9d5f60e76655bef84b38ee3bae781c07428..19d1a2dba9eea112b2a93c69ed7c5832612cb227 100644 GIT binary patch delta 46 vcmX>m@J3*R8;2SfLpnn#LmopWLo!1?LlKZ=3xq}t#teE424Kv~z{LOn`j`k9 delta 7 OcmaDOa78wUUlodVGS