我有一个运行django 1.7.4的网站,我正在尝试升级到django 1.9.5:
当我运行./manage.py runserver
时,我得到:
Unhandled exception in thread started by <function wrapper at 0x111306c80>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/myuser/projects/mysite/myapp/__init__.py", line 1, in <module>
import signals
File "/Users/myuser/projects/mysite/myapp/signals.py", line 1, in <module>
from paypal.standard.models import ST_PP_COMPLETED
File "/usr/local/lib/python2.7/site-packages/paypal/standard/models.py", line 44, in <module>
class PayPalStandardBase(Model):
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
app_config = apps.get_containing_app_config(module)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
self.check_apps_ready()
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
我将django 1.7.4安装在virtualenv中,并且该版本一切正常。当我尝试使用django 1.9运行它时,会出现这个错误。有任何想法吗?
(我已经尝试按照其他答案中的建议将django.setup()
添加到settings.py
,但它没有帮助(并且阅读文档我觉得它不应该存在)
感谢您的帮助。