0

I have a website running django 1.7.4 and i am trying to upgrade to django 1.9.5:

When I run ./manage.py runserver I get:

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.

I have django 1.7.4 installed in a virtualenv and with that version everything works fine. When i try to run it using django 1.9 this errors comes up. Any ideas?

(I have already tried to add django.setup() to settings.py as suggested in other answers, but it did not help (and reading the docs i feel it should not be there anyways)

Thank you for your help.

pnjun
  • 119
  • 7
  • 1
    You need to move the signal registration from your app's `__init__` method into the `ready()` method. See [this question](http://stackoverflow.com/questions/35797839/django-1-9-django-core-exceptions-appregistrynotready-apps-arent-loaded-yet/35798074#35798074) for an example. – Alasdair Apr 13 '16 at 13:06
  • 2
    This is a duplicate, there are a lot of posts about this error when upgrading. Also, you should not skip 1.8 when upgrading. You will miss some warnings etc. – Lucas03 Apr 13 '16 at 13:20
  • 1
    @Lucas03 I've check that answer before posting, and it does not apply to my case. I will now try Alasdair suggestion and see what happens. – pnjun Apr 13 '16 at 13:47
  • @Alasdair: Thank you, that solved the problem! – pnjun Apr 13 '16 at 14:04
  • @pnjun glad it helped :) – Alasdair Apr 13 '16 at 14:12

0 Answers0