700 B
700 B
Python Flask订餐系统
环境要求
- Linux系统
- Python 3.9+
- MySQL 5.7+
启动服务
# 本地开发环境
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自动生成模型:
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