57 lines
1.2 KiB
Markdown
57 lines
1.2 KiB
Markdown
|
|
# Gunicorn快速参考
|
||
|
|
|
||
|
|
## 🚀 一键操作命令
|
||
|
|
|
||
|
|
### 启动服务
|
||
|
|
```bash
|
||
|
|
./scripts/start_gunicorn.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
### 停止服务
|
||
|
|
```bash
|
||
|
|
./scripts/stop_gunicorn.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
### 重启服务
|
||
|
|
```bash
|
||
|
|
./scripts/restart_gunicorn.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
### 查看状态
|
||
|
|
```bash
|
||
|
|
./scripts/status_gunicorn.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
## 📋 常用命令
|
||
|
|
|
||
|
|
| 操作 | 命令 |
|
||
|
|
|------|------|
|
||
|
|
| 启动 | `./scripts/start_gunicorn.sh` |
|
||
|
|
| 停止 | `./scripts/stop_gunicorn.sh` |
|
||
|
|
| 重启 | `./scripts/restart_gunicorn.sh` |
|
||
|
|
| 状态 | `./scripts/status_gunicorn.sh` |
|
||
|
|
| 查看日志 | `tail -f logs/gunicorn_access.log` |
|
||
|
|
| 测试访问 | `curl http://localhost:5002/` |
|
||
|
|
|
||
|
|
## 🌐 访问信息
|
||
|
|
|
||
|
|
- **本地访问**: http://localhost:5002
|
||
|
|
- **外网访问**: http://101.43.95.130:5002
|
||
|
|
- **服务端口**: 5002
|
||
|
|
- **Python环境**: 3.12.7 (myenv)
|
||
|
|
|
||
|
|
## 📁 重要文件
|
||
|
|
|
||
|
|
- **配置文件**: `gunicorn.conf.py`
|
||
|
|
- **PID文件**: `logs/gunicorn.pid`
|
||
|
|
- **访问日志**: `logs/gunicorn_access.log`
|
||
|
|
- **错误日志**: `logs/gunicorn_error.log`
|
||
|
|
- **管理脚本**: `scripts/`
|
||
|
|
|
||
|
|
## ⚠️ 注意事项
|
||
|
|
|
||
|
|
1. 确保在项目目录下执行命令
|
||
|
|
2. 确保conda环境已激活
|
||
|
|
3. 确保5002端口未被占用
|
||
|
|
4. 确保防火墙已开放5002端口
|