2019-07-22 14:50:06 +08:00
|
|
|
|
Python Flask订餐系统
|
|
|
|
|
|
=====================
|
|
|
|
|
|
|
2026-01-09 18:07:01 +08:00
|
|
|
|
## 环境要求
|
|
|
|
|
|
- Linux系统
|
|
|
|
|
|
- Python 3.9+
|
|
|
|
|
|
- MySQL 5.7+
|
2019-07-22 14:50:06 +08:00
|
|
|
|
|
2026-01-09 18:07:01 +08:00
|
|
|
|
## 启动服务
|
|
|
|
|
|
```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
|
|
|
|
|
|
```
|