Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django upgrading to 1.9 error "AppRegistryNotReady: Apps aren't loaded yet."

Tags:

python

django

When upgraded to django 1.9 from 1.8 I got this error. I checked answers for similar questions, but I didn't think this is an issue with any 3rd party packages or apps.

Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 176, in fetch_command
commands = get_commands()
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
result = user_function(*args, **kwds)
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 71, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/home/kishore/.virtualenvs/andone/local/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/home/kishore/.virtualenvs/andone/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'd modified the Installed apps for 'django.contrib.auth'.

like image 836
Kishore K Avatar asked Dec 06 '15 05:12

Kishore K


2 Answers

Try to add this lines to the top of your settings file:

import django
django.setup()

And if this will not help you try to remove third-party applications from your installed apps list one-by-one.

like image 76
inlanger Avatar answered Nov 13 '22 10:11

inlanger


I'd a custom function written on one of my models __init__.py file. It was causing the error. When I moved this function from __init__.py it worked.

like image 49
Kishore K Avatar answered Nov 13 '22 11:11

Kishore K