feat: 完善文档和界面,增加盒子类型支持及批量新增功能

This commit is contained in:
2026-03-08 02:16:20 +08:00
parent fc38b1eb3d
commit 672336c578
6 changed files with 696 additions and 32 deletions

93
README-DEPLOY.md Normal file
View File

@@ -0,0 +1,93 @@
# README-DEPLOY
仅保留部署命令,按顺序执行。
## 1. 首次部署(服务器)
```bash
cd /www/wwwroot
git clone <your_repo_url> inventory
cd inventory
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python init_db.py
```
## 2. 启动(临时测试)
```bash
cd /www/wwwroot/inventory
source venv/bin/activate
python app.py
```
访问:`http://127.0.0.1:5000`
## 3. 生产启动Gunicorn
先安装:
```bash
cd /www/wwwroot/inventory
source venv/bin/activate
pip install gunicorn
```
启动:
```bash
cd /www/wwwroot/inventory
source venv/bin/activate
gunicorn -w 2 -b 127.0.0.1:5000 app:app
```
说明:建议只监听 `127.0.0.1`,由 Nginx/宝塔反向代理。
## 4. 每次发布更新
### 本地
```bash
cd C:/Users/BeihongWang/Desktop/inventory
git add .
git commit -m "feat: your change"
git push origin main
```
### 服务器
```bash
cd /www/wwwroot/inventory
git pull origin main
source venv/bin/activate
pip install -r requirements.txt
```
然后在宝塔中重启 Python 项目(或重启 Gunicorn 进程)。
## 5. 数据库备份
```bash
cp /www/wwwroot/inventory/data/inventory.db /www/backup/inventory_$(date +%F).db
```
## 6. 快速排查
查看服务端口是否监听:
```bash
ss -lntp | grep 5000
```
本机探活:
```bash
curl http://127.0.0.1:5000
```
若域名打不开,优先检查:
1. Python 项目是否运行中
2. 域名解析是否生效
3. Nginx/宝塔反向代理是否指向 `127.0.0.1:5000`