django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. (django 2.0.1)(Python 3.6) django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. (django 2.0.1)(Python 3.6) python python

django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. (django 2.0.1)(Python 3.6)


Overcame similar situation just now.

All you really need is this:

import osos.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_project.settings")

And then these lines:

from django.core.wsgi import get_wsgi_applicationapplication = get_wsgi_application()

After that you can easily import models without AppRegistryNotReady: Apps aren't loaded yet.

UPDATE: This is really exactly the 4 code lines from wsgi.py file in your project's folder.

FOR DJANGO 3.0In Django 3+ an extra variable is needed to resolve sync/async confusing:

os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"


Please run check django-admin command to see if it have detected any errors.

python manage.py check

and/or

django-admin check


The Django docs say that django.setup loads the settings from settings.py as its first act, so it seems like a bad idea to run that in settings.py.

Try commenting out apps in INSTALLED_APPS one at a time - you'll probably find that one of them is not loading for some reason. Once you know which one it is, you can work out what is wrong with it.