django - 如何修复 : "RuntimeWarning: Model <my_model> was already registered."

标签 django ipython

自从升级 Django 以来,我在 iPython 中执行导入时一直收到此错误:

RuntimeWarning: Model 'docket.search' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.



我猜这是 iPython 的一些自动功能,但是有简单的解决方案吗?这是我什至需要解决的问题吗?

最佳答案

完全相同的问题也发生在我身上。问题是我已经定义了两次模型!删除其中之一解决了问题。

关于django - 如何修复 : "RuntimeWarning: Model <my_model> was already registered.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32025480/

相关文章:

python - 如何将嵌套类别添加到 Django 模型?

django-social-auth : logging in from a unit test client

python - 在 Spyder 中使用 input() 时 Matplotlib 卡住

python - ipython 读取错误的 python 版本

python - 如何在 ipython session 中完全重置 Python stdlib 日志记录模块?

python - Django 模型 manytomany 字段计数出现

python - 如何从 Django 迁移中调用基于实例的函数并访问实例变量

css - 我需要在 django 中指定一些 id 以便稍后将其添加到 Bootstrap 中

python - 如何在 PyCharm 中设置 ipython 配置文件

python - 更改 Pandas 中的默认选项