我一直在使用[django-registration](https://bitbucket.org/ubernostrum/django-registration),現在我已經開始使用django 1.7b1,這裏是錯誤,我得到了下面複製的錯誤。它正在從Django的註冊提出在models.py
:與Django的Django註冊兼容性問題1.7
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
,似乎它正在升起,因爲get_user_model()
被調用之前應用註冊表已準備就緒。我不確定這是否兼容性問題,如果是,是否有一個簡單的解決方法?如果不是,你能幫我確定我做錯了什麼嗎?
RuntimeError: App registry isn't ready yet.
File "/Users/nima/pe-dev/manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/core/management/__init__.py", line 427, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/core/management/__init__.py", line 391, in execute
django.setup()
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/apps/registry.py", line 106, in populate
app_config.import_models(all_models)
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/apps/config.py", line 190, in import_models
self.models_module = import_module(models_module_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/registration/models.py", line 15, in <module>
User = get_user_model()
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/contrib/auth/__init__.py", line 136, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/apps/registry.py", line 187, in get_model
self.check_ready()
File "/Library/Python/2.7/site-packages/Django-1.7b1-py2.7.egg/django/apps/registry.py", line 119, in check_ready
raise RuntimeError("App registry isn't ready yet.")
您先生 - 和github用戶macropin - 救了我。 –
它的點子:pip安裝django-registration-redux –
感謝提示@VisgeanSkeloru。我已經更新了答案,以反映更簡單的安裝過程。 – ptevans