[Django]-Django 1.7 upgrade error: AppRegistryNotReady: Apps aren't loaded yet

91๐Ÿ‘

๐Ÿ‘คAviah Laor

74๐Ÿ‘

I had a similar (the same?) isssue when upgrading to Django 1.7. In may case, it was enough to update the wsgi file: replace

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

with

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
๐Ÿ‘คsamirj

22๐Ÿ‘

I was looking through all these thread to get celery working on windows (with this particular error message) and I just want to emphasize putting

import django
django.setup()

at the top of your tasks.py file, this is finally what got it working for me.

๐Ÿ‘คHussienK

12๐Ÿ‘

INSTALLED_APPS Had an missing comma in the array, that caused the error for me.

๐Ÿ‘คMihkel L.

12๐Ÿ‘

I got this error when I tried to import models from the appโ€™s __init__.py, which is not possible.

๐Ÿ‘คMark

6๐Ÿ‘

In configuration uwsgi application file ( like uwsgi.ini ) replace:

module = django.core.handlers.wsgi:WSGIHandler()

on

module=django.core.wsgi:get_wsgi_application()
๐Ÿ‘คiqmaker

1๐Ÿ‘

settings.AUTH_USER_MODEL is a string (thatโ€™s why you get AttributeError: 'str' object has no attribute '_meta' โ€“ it expects a Model) and should be used only on ForeignKey declarations:

class Article(models.Model):
    author = models.ForeignKey(settings.AUTH_USER_MODEL)

If you want to refer to your user model somewhere else you need to use get_user_model:

from django.contrib.auth import get_user_model

UserModel = get_user_model()
๐Ÿ‘คSerafeim

1๐Ÿ‘

I got this error when moving to a different PC and forgetting to install psycopg2 in my venv and when using 'ENGINE': 'django.db.backends.postgresql', in my settings.

Perhaps it can be useful to someone else.

๐Ÿ‘คSaeX

1๐Ÿ‘

In my case SEcret_key was commented by mistake in settings.py

๐Ÿ‘คEMT

0๐Ÿ‘

In my case, I forgot to add one of my sub-applications inside INSTALLED_APPS.

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'basketball',
    'basketball.area',
    'basketball.game',
    'basketball.player',
]
๐Ÿ‘คmatox

0๐Ÿ‘

In my case the error was caused when I upgraded celery to 4.x and I had this in my INSTALLED_APPS: kombu.transport.django. Removing that resolved the issue. Seems it is mostly caused by some incorrect load of django itself.

๐Ÿ‘คK.H.

0๐Ÿ‘

For those (like me) who are getting this error from shell:

Check that you are executing Djangoโ€™s shell and not Pythonโ€™s shell.

python manage.py shell
๐Ÿ‘คoz19

-3๐Ÿ‘

Just reinstall Django using the command line, not in Pycharm helped to me.

๐Ÿ‘คYura Liashenko

Leave a comment