如何在没有模型的情况下安装Django应用程序? [英] How to install Django app without its models?

查看:42
本文介绍了如何在没有模型的情况下安装Django应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个我想添加到 INSTALLED_APPS 的第三方Django应用程序,但是我不打算使用它的模型,我希望不要让它们污染我的数据库.如何实现?

There's a third party Django application that I want to add to INSTALLED_APPS, but I'm not going to use its models and I would prefer to not have them polluting my database. How to achieve that?

推荐答案

不确定我会推荐这样做,但是如果您愿意,可以使用

Not sure I would recommend doing this, but if you want to you can override the migrations using the MIGRATIONS_MODULES setting:

MIGRATION_MODULES = {
    'app_name': None,
}

这将禁用该应用程序的迁移.但是就像上王说的那样,如果您执行此操作,并且该应用需要这些模型,则该应用将无法运行.

This will disable migrations for that application. But like Shang Wang said, if you do this and the app requires those models then the app won't work.

这篇关于如何在没有模型的情况下安装Django应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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