[Django] #25634: AppRegistryNotReady Error

84 views
Skip to first unread message

Django

unread,
Oct 29, 2015, 8:26:43 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error
-------------------------------+--------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Migrating my project from 1.8.5 to 1.9b1 cause next traceback:


{{{
Traceback (most recent call last):
File "/Users/.../manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 350, in
execute_from_command_line
utility.execute()
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 176, in fetch_command
commands = get_commands()
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 71, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/Users/.../env3/lib/python3.5/site-
packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/Users/.../env3/lib/python3.5/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.

Process finished with exit code 1

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25634>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 29, 2015, 8:28:55 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error
-------------------------------+--------------------------------------

Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by wide-awake):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

New description:

Migrating my project from 1.8.5 to 1.9b1 cause next traceback, when
running server:

{{{
Traceback (most recent call last):
File "/Users/.../manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 350, in
execute_from_command_line
utility.execute()
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 176, in fetch_command
commands = get_commands()
File "/Users/.../env3/lib/python3.5/site-
packages/django/core/management/__init__.py", line 71, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/Users/.../env3/lib/python3.5/site-
packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/Users/.../env3/lib/python3.5/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.

Process finished with exit code 1

}}}

And my manage.py is pretty simple:

{{{
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.base")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:1>

Django

unread,
Oct 29, 2015, 8:31:11 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error
-------------------------------+--------------------------------------

Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by timgraham):

We'll need a sample project to reproduce the problem. It's not possible to
help given what you provided so far. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:2>

Django

unread,
Oct 29, 2015, 8:38:44 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error
-------------------------------+--------------------------------------

Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by wide-awake):

Traceback is poor on details, so i just back to 1.8.5.
Even if i could share project it won't work standalone.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:3>

Django

unread,
Oct 29, 2015, 8:43:33 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------+--------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


Comment:

The only thing that comes to mind is #25477 but that doesn't look relevant
here.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:4>

Django

unread,
Oct 29, 2015, 8:47:18 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------+--------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by DheerendraRathor):

I usually switch back and forth between 1.8.5 and 1.9b1 and never got this
error. Is there any third party app you're using?

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:5>

Django

unread,
Oct 29, 2015, 9:28:49 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------+--------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by wide-awake):

All my third part apps:

{{{
THIRD_PARTY_APPS = (
'gunicorn',
'opbeat.contrib.django',
# Wagtail CMS
'taggit',
'compressor',
'modelcluster',

'wagtail.contrib.wagtailstyleguide',
'wagtail.wagtailcore',
'wagtail.wagtailadmin',
'wagtail.wagtailsearch',
'wagtail.wagtailimages',
'wagtail.wagtaildocs',
'wagtail.wagtailsnippets',
'wagtail.wagtailusers',
'wagtail.wagtailsites',
'wagtail.wagtailembeds',
'wagtail.wagtailredirects',
'wagtail.wagtailforms',

'wagtailforums',
'wagtailmodeladmin',
)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:6>

Django

unread,
Oct 29, 2015, 9:45:42 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------+--------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by wide-awake):

It's specifically Wagtail CMS package problem.
Installing wagtail dev versions from github solved this error.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:7>

Django

unread,
Oct 29, 2015, 10:30:31 AM10/29/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------+--------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.9b1
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* resolution: needsinfo => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:8>

Django

unread,
Oct 30, 2015, 10:19:15 AM10/30/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.9b1
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: closed => new
* resolution: invalid =>
* type: Uncategorized => Bug
* component: Uncategorized => Core (Management commands)
* stage: Unreviewed => Accepted


Comment:

I've had this same error in one of my projects, and I'd like to reopen it
because I think there is an exception swallowing which masks real errors.
(was related to django-reversion in my case).
With `runserver --noreload`, I'm getting the proper traceback which
reveals the real problem, but without the `--noreload`, I'm getting the
useless traceback mentioned by the reporter.

The problem is with this exception catching:
https://github.com/django/django/blob/stable/1.9.x/django/core/management/__init__.py#L315-L317

Frankly, I'd rather live with an autoreloader not restarting in case of
syntax errors (#24704) than with exception swallowing.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:9>

Django

unread,
Oct 30, 2015, 11:18:05 AM10/30/15
to django-...@googlegroups.com
#25634: AppRegistryNotReady Error upgrading from Django 1.8 to 1.9
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.9b1
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by collinanderson):

We could maybe print the traceback yet still have the program continue (in
case there's a more specific error message later).

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:10>

Django

unread,
Oct 30, 2015, 11:32:11 AM10/30/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.8

commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* version: 1.9b1 => 1.8


--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:11>

Django

unread,
Nov 27, 2015, 4:30:53 AM11/27/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by unklphil):

This is a real problem, as it seems to label other exceptions as
`django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.`

I had a working Django 1.9rc2 application yesterday, but this morning when
I tried to run `runserver`, I got:

{{{
Traceback (most recent call last):

File "./manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/Users/phil/env/lib/python2.7/site-


packages/django/core/management/__init__.py", line 350, in
execute_from_command_line
utility.execute()

File "/Users/phil/env/lib/python2.7/site-


packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)

File "/Users/phil/env/lib/python2.7/site-


packages/django/core/management/__init__.py", line 176, in fetch_command
commands = get_commands()

File "/Users/phil/env/lib/python2.7/site-
packages/django/utils/lru_cache.py", line 100, in wrapper
result = user_function(*args, **kwds)
File "/Users/phil/env/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 "/Users/phil/env/lib/python2.7/site-


packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()

File "/Users/phil/env/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.
}}}

This was curious, as I hadn't changed any of the code or packages, so the
`AppRegistryNotReady` didn't make any sense.

After a lot of troubleshooting and googling, I found claudep's suggestion
of using `--noreload` to display the actual error and discovered that the
error had nothing to do with apps not being ready. The exception it was
masking was:

{{{
Traceback (most recent call last):

File "./manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "/Users/phil/env/lib/python2.7/site-


packages/django/core/management/__init__.py", line 350, in
execute_from_command_line
utility.execute()

File "/Users/phil/env/lib/python2.7/site-
packages/django/core/management/__init__.py", line 324, in execute
django.setup()
File "/Users/phil/env/lib/python2.7/site-packages/django/__init__.py",
line 17, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/Users/phil/env/lib/python2.7/site-packages/django/utils/log.py",
line 71, in configure_logging
logging_config_func(logging_settings)
File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 794, in dictConfig
dictConfigClass(config).configure()
File
"/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 576, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler u'app_log_file': [Errno 2] No such
file or directory: u'/var/log/myapp/application.log'
}}}

Turns out an OS update removed my log directory, and it couldn't create
the logfiles on startup, but it took me about an hour of troubleshooting
to find this simple solution just because I was getting the wrong
exception the whole time.

IMO this is a major problem, because firstly, the `AppRegistryNotReady`
traceback is not helpful at all, because it doesn't tell you where the
problem is, and secondly, it's not even the correct exception.

Seeing as most Django developers use runserver to develop, I would even
consider labelling this as a release blocker.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:12>

Django

unread,
Nov 27, 2015, 6:07:02 AM11/27/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Release blocker | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* version: 1.8 => 1.9rc1
* severity: Normal => Release blocker


Comment:

Perhaps we could print the traceback here on Python 2:
https://github.com/django/django/blob/9bc0c21b/django/core/management/__init__.py#L313

I believe this bug doesn't affect Python 3 thanks to exception chaining.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:13>

Django

unread,
Nov 27, 2015, 7:24:01 AM11/27/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by wide-awake):

Replying to [comment:13 aaugustin]:


> I believe this bug doesn't affect Python 3 thanks to exception chaining.

It's weird, because my original exception was in Python 3.5

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:14>

Django

unread,
Nov 28, 2015, 4:18:17 AM11/28/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by tino):

It happens to me in Python 3.4 as well.

It is also caused when trying to import something in an app's
`__init__.py`, as some apps do. When that import fails, I see the
`django.core.exceptions.AppRegistryNotReady` exception. Running the
`shell`-management command (or `runserver --noreload`) allows me to see
what is going on.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:15>

Django

unread,
Dec 1, 2015, 6:39:16 AM12/1/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mlorant):

Indeed, same behaviour, on Python 2.7.10 as well. A simple way to
reproduce it is to install a third party app that use removed features of
Django 1.9.

Tim said this wasn't a release block for the 1.9 (cf status of 1.9 on dev
ML), but I tend to disagree, it makes the migration harder if you don't
find this ticket and without knowing the `--noreload` option.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:16>

Django

unread,
Dec 1, 2015, 9:08:18 AM12/1/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody

Type: Bug | Status: new
Component: Core (Management | Version: 1.9rc1
commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

The fix for #24704 was backported to 1.8 too. That's why I changed the
version to 1.8 as I don't believe the issue is specific to 1.9, but I
could be missing something.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:17>

Django

unread,
Dec 1, 2015, 11:21:47 AM12/1/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: 1.8

commands) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* version: 1.9rc1 => 1.8


--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:18>

Django

unread,
Dec 18, 2015, 7:12:54 PM12/18/15
to django-...@googlegroups.com
#25634: runserver reloader masks exceptions
-------------------------------------+-------------------------------------
Reporter: wide-awake | Owner: nobody
Type: Bug | Status: closed
Component: Core (Management | Version: 1.9
commands) |
Severity: Release blocker | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* version: 1.8 => 1.9
* resolution: => duplicate


Comment:

Upon further investigation, it looks like the fix for #25510 simply wasn't
backported to the stable/1.9.x branch. I have done that in
24ebf17f04ee0ed157c430ff7d10ec0728abd48e.

--
Ticket URL: <https://code.djangoproject.com/ticket/25634#comment:19>

Reply all
Reply to author
Forward
0 new messages