1

I upgraded from Django 1.8 to 1.9 but facing this problem

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

None of the other solutions on stackoverflow worked.

I already tried other solution like adding

import django
django.setup()

but no success.

File "/home/adithya/git/django_proj/manage.py", line 7, in <module>
    from django.contrib.sites.models import Site
  File "/home/adithya/git/virtualenv/env/local/lib/python2.7/site-packages/django/contrib/sites/models.py", line 83, in <module>
    class Site(models.Model):
  File "/home/adithya/git/virtualenv/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/adithya/git/virtualenv/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/home/adithya/git/virtualenv/env/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.
souldeux
  • 3,615
  • 3
  • 23
  • 35
Adithya d
  • 43
  • 1
  • 7

2 Answers2

0

Too long for a comment, so I will leave the answer )

There are a lot of ways to get this error actually, you just need to find it. I left some popular variants below, but the real cause in your case may be different.

Check:

  1. Any custom functions in models init.py files - they may be the cause
  2. Also, consider that Django requires django.setup() to be run before parts of an app can be called. During the setup phase, one important thing that it does is apps.populate(settings.INSTALLED_APPS). If you try to access an app before setup has run the function check_apps_ready will raise AppRegistryNotReady("Apps aren't loaded yet.")
  3. This exception may occur due to a misconfiguration of wsgi file

Also, you can try to disable your apps in INSTALLED_APPS one by one, maybe that will identify where the problem is coming from?

Igor Belkov
  • 446
  • 3
  • 8
0

I Fixed by removing depricated code in manage.py. Also i was using old s3 storage (boto3 apps) which was incompatible with new Django Versions. Fixing those two issues solved my problem.

Adithya d
  • 43
  • 1
  • 7