python反向生成数据库模型类

之前去的一家公司,去的时候项目已经好了,但是需要我根据数据库做一个后台管理系统,管理用户和其他的一些数据。

直接说方法

django框架

python manage.py inspectdb > models.py

flask框架

pip install sqlacodegen
sqlacodegen postgresql://ridingroad:ridingroad@127.0.0.1:5432/postgres --outfile=models.py  --tables friends

参考链接

https://mp.weixin.qq.com/s/FaDp3dQt1lQFpUbdFcFNaQ

https://blog.csdn.net/u010085423/article/details/80169320

原文地址:https://www.cnblogs.com/blog-rui/p/10644258.html