可运行

This commit is contained in:
rjb
2026-01-09 18:07:01 +08:00
parent 695ec0b000
commit d2df37b9af
153 changed files with 832 additions and 904 deletions

View File

@@ -1,9 +1,26 @@
Python Flask订餐系统
=====================
##启动
* export ops_config=local|production && python manage.py runserver
##flask-sqlacodegen
## 环境要求
- Linux系统
- Python 3.9+
- MySQL 5.7+
flask-sqlacodegen 'mysql://root:123456@127.0.0.1/food_db' --outfile "common/models/model.py" --flask
flask-sqlacodegen 'mysql://root:123456@127.0.0.1/food_db' --tables user --outfile "common/models/user.py" --flask
## 启动服务
```bash
# 本地开发环境
export ops_config=local && python manager.py runserver
# 生产环境
export ops_config=production && python manager.py runserver
```
## 数据库配置
数据库连接信息在 `config/base_setting.py``config/production_setting.py` 中配置。
## 生成ORM模型
使用flask-sqlacodegen自动生成模型
```bash
flask-sqlacodegen 'mysql://root:password@host:port/food_db' --outfile "common/models/model.py" --flask
flask-sqlacodegen 'mysql://root:password@host:port/food_db' --tables user --outfile "common/models/user.py" --flask
```