如何解决Django的AppRegistryNotReady(1.7.1)

时间:2015-01-09 09:17:31

标签: django django-templates

安装django-registration后,事情发生了。 我把app命名为#34;注册"在安装的应用程序下。它现在给了我。我试图解决这个问题,但不知道如何解决它。在Stackoverflow中,我发现了类似的问题和解决方案。但我无法添加像" import django"和" django.setup()"到registry.py文件。我已经完成了改变wsgi.py文件的工作

File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/registration/models.py", line 15, in <module>
    User = get_user_model()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 136, in get_user_model
    return django_apps.get_model(settings.AUTH_USER_MODEL)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
    self.check_models_ready()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

这是我的wsgi.py文件。

import os
import sys

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "realpro.settings")

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

对于我和所有开始安装&#34; django-registration&#34;程序。

1 个答案:

答案 0 :(得分:1)

您是否尝试使用实际维护的分叉here?既然你说你安装了'django-registration'而不是'django-registration-redux',那么如果你不想自己修复这个项目,这可能是你最好的选择。