冲洗单个应用程序django 1.9 [英] Flush single app django 1.9

查看:49
本文介绍了冲洗单个应用程序django 1.9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的django项目有多个应用程序.我正在尝试找到一种方法来从单个django应用程序中刷新数据库中的所有数据.我在django的早期版本中找到了一些方法,但是找不到可用于1.9版的东西.

My django project has multiple apps. I am trying to find a way to flush all the data from DB for a single django app. I found some ways to do in earlier versions of django but couldn't find something that could be used for version 1.9 .

有没有办法做到这一点,或者我需要从数据库中手动删除数据/为我的应用创建自定义命令?

Is there a way to do this or do I need to manually delete data from DB/create custom command for my app?

推荐答案

您可以使用 migrate 命令:

./manage.py migrate app_name zero

我在django-1.8中使用了它.我不确定django-1.9,但应该可以.

I used it in django-1.8. I am not sure about django-1.9 but it should work.

这篇关于冲洗单个应用程序django 1.9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆