可运行
This commit is contained in:
27
readme.md
27
readme.md
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user