django shell 操作

插件:django-extensions

django-extensions==1.9.8

pip3 install  django-extensions

1.数据库shell 命令(项目目录下)

  python3 manage.py dbshell

  执行sql语句

2.查看django orm对应的sql语句

  https://www.jianshu.com/p/9ac4ca98b8e4 

  python manage.py shell_plus --print-sql

  在此Shell中你通过Django对数据库执行的所有操作都会自动打印出其对应的SQL语句.

原文地址:https://www.cnblogs.com/shmily3929/p/9103793.html