可以在Django中自动删除陈旧的内容类型吗? [英] Can stale content types be automatically deleted in Django?

查看:149
本文介绍了可以在Django中自动删除陈旧的内容类型吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个PyQt应用程序,它使用Django将其内容提供给桌面用户。

I'm working with a PyQt application which uses Django to deliver it's content to desktop users.

在最新的更新中,我们将存储在数据库中的陈旧内容类型由Django和启动应用程序South的migrate或syncdb提供删除它们。可以通过调用迁移/ syncdb来自动删除这些内容来执行某些操作吗?

In the latest update we have stale content types stored in the database by Django and on startup of the application South's migrate or syncdb offers to delete them. Is it possible to do something with the call to migrate/syncdb that automatically deletes these?

由于明显的原因,此提示不能暴露给最终用户,所以我真的希望有一些方法我们可以自动采取这种方式:)

This prompt can't be exposed to the end user for obvious reasons, so I really hope there is some way we can take car of this automatically :)

我已经看到,与南迁移可以调用 noinput ,但不会删除它们,如果我们知道这将是安全的,那么这样做会很好。

I've seen that with the South migrate you can call --noinput but that doesn't delete them, and it'd be good if we could do that as we know it'll be safe.

推荐答案

在unix系统上有一个命令 yes ,它将重复输出一个字符串到stdout,用换行符分隔。我们可以用这个来自动回答这个提示。

On unix systems there is a command yes, which will repeatedly output a string to stdout, separated by newlines. We can use this to auto-answer this prompt.

是yes python ./manage.py migrate

这篇关于可以在Django中自动删除陈旧的内容类型吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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