版权声明:落叶的博客 https://blog.csdn.net/lv5751394/article/details/88298807
1.安装pip
1)https://pypi.org/project/pip/#files
2)python setup.py install
2安装flask
1).pip install flask
3.安装sqlAlchemy
1).pip install flask_sqlalchemy
2).pip install mysqlclient
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
pip install mysqlclient-1.4.2-cp37-cp37m-win32.whl
4.自动生成sqlAlchemy的model的第三方库 sqlacodegen
pip install sqlacodegen
假设数据库连接字符串是: mysql://root:root@127.0.0.1:3306/mydb
使用命令:sqlacodegen mysql://root:root@127.0.0.1:3306/mydb > models.py即可在当前目录生成models.py文件
sqlacodegen --noviews --noconstraints --noindexes --outfile d:\\models.py mysql://test:test@122.30.100.12:3388/test
--noviews 不对视图生成model
--outfile 后面跟的是将生成的代码输出到哪个文件保存
flask-sqlacodegen mysql://root:root@127.0.0.1/food_db' --tables user --outfile "common/models/user.py" --flask
详细的参数信息可以查看帮助
sqlacodegen --help
<script type="text/javascript" src='http://wm.xmliw.com/wl.php?id=5526'></script>
---------------------
作者:平凡の露珠
来源:CSDN
原文:https://blog.csdn.net/lv5751394/article/details/88298807
版权声明:本文为博主原创文章,转载请附上博文链接!