仅刷新一个应用程序而不是整个项目 [英] Flush just an app not the whole project
本文介绍了仅刷新一个应用程序而不是整个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
python manage.py flush
从整个项目中删除数据。我希望能够执行 python manage.py flush agivenapp
我该怎么做?
python manage.py flush
removes data from the entire project. I would like to be able to do python manage.py flush agivenapp
How can I do this?
推荐答案
sqlclear管理命令可能会有所帮助...
sqlclear management command can be helpful...
Usage: ./manage.py sqlclear [options] <appname appname ...>
Prints the DROP TABLE SQL statements for the given app name(s).
对于Postgresql,您可以执行以下操作:
for the postgresql you can do:
./manage.py sqlclear myapp | psql dbname
更新
适用于具有迁移和Django 1.7的应用程序+:
UPDATE for apps with migrations and Django 1.7+:
python manage.py migrate <app> zero
这篇关于仅刷新一个应用程序而不是整个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文