[英]Python Django Unknown Command 'SQL'
我正在关注本教程http://www.sitepoint.com/building-simple-rest-api-mobile-applications/
我正在尝试运行SQL
$ python manage.py sql fishes
然而它说
Unknown Command: 'sql'
如果我输入
$ python manage.py help
我明白了,SQL没有出现在列表中。
Available subcommands:
[auth]
changepassword
createsuperuser
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver
[sessions]
clearsessions
[staticfiles]
collectstatic
findstatic
runserver
不幸的是,这不再存在,但是命令manage.py dbshell
。
但是,一般来说,您应该尝试使用load_data等模型来保持数据的完整性(因为验证等可能在模型中发生,而不是依赖于底层数据位)。 或者为任何清理任务编写管理命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.