获取" STR"没有财产" _default_manager"在Django应用程序刚启动时 [英] Getting the "str" has no property "_default_manager" on a Django app just on startup

查看:149
本文介绍了获取" STR"没有财产" _default_manager"在Django应用程序刚启动时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

右键后,我重新启动Apache拿起新的Django的变化,我得到以下错误的大概30秒到一分钟算账:

Right after I restart Apache to pick up the new Django changes, I get the following errors for probably 30 seconds to a minute afterwards:

ViewDoesNotExist:模块project.app.views试过home_page。错误是:'海峡'对象有没有属性'_default_manager

该错误消失后位,但它是非常奇怪的。任何想法如何调试这或什么可能导致它?

The errors go away after a bit, but it's very odd. Any idea how to debug this or what might be causing it?

推荐答案

我觉得这是这个错误:

<一个href=\"http://$c$c.djangoproject.com/ticket/10405#comment:11\">http://$c$c.djangoproject.com/ticket/10405#comment:11

好像在考虑谷歌搜索不显示其他东西的完美契合,那你的问题在​​一段时间后会消失 - 根据这张票因型号字符串的延迟加载

Seems like a perfect fit considering google searches don't show much else, and that your problem goes away after some time - according to this ticket due to lazy loading of model strings.

的意见建议将您的管理员自动发现功能之​​前,下面的。

The comment suggests adding the following before your admin autodiscover function.

from django.db.models.loading import cache as model_cache
if not model_cache.loaded:
    model_cache.get_models()

这篇关于获取&QUOT; STR&QUOT;没有财产&QUOT; _default_manager&QUOT;在Django应用程序刚启动时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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