[Django] #21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."

52 views
Skip to first unread message

Django

unread,
Jan 26, 2014, 1:46:25 AM1/26/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
------------------------------------+--------------------------------------
Reporter: | Owner: nobody
benjamin.e.white1@… | Status: new
Type: Bug | Version: 1.7-alpha-1
Component: Uncategorized | Keywords: Django-Tastypie, python3
Severity: Normal | Has patch: 0
Triage Stage: Unreviewed | UI/UX: 0
Easy pickings: 0 |
------------------------------------+--------------------------------------
Including django-tastypie as installed app prevents me from running
server, migrating, etc. I'm on Python 3.3.3

Traceback pasted below. Goes away when I remove django-tastypie as
installed app.
{{{
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/benjaminwhite/django-
trunk/django/core/management/__init__.py", line 427, in
execute_from_command_line
utility.execute()
File "/Users/benjaminwhite/django-
trunk/django/core/management/__init__.py", line 391, in execute
django.setup()
File "/Users/benjaminwhite/django-trunk/django/__init__.py", line 21, in
setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
105, in populate
app_config.import_models(all_models)
File "/Users/benjaminwhite/django-trunk/django/apps/base.py", line 180,
in import_models
self.models_module = import_module(models_module_name)
File
"/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/importlib/__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in
module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in
_call_with_frames_removed
File "/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/site-
packages/tastypie/models.py", line 32, in <module>
from tastypie.compat import AUTH_USER_MODEL
File "/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/site-
packages/tastypie/compat.py", line 14, in <module>
User = get_user_model()
File "/Users/benjaminwhite/django-
trunk/django/contrib/auth/__init__.py", line 133, in get_user_model
user_model = apps.get_model(app_label, model_name)
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
182, in get_model
self.check_ready()
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
118, in check_ready
raise RuntimeError("App registry isn't ready yet.")
RuntimeError: App registry isn't ready yet.
(HUMAN_WRITES)Benjamins-MacBook-Air:narrativize benjaminwhite$ python
manage.py runserver
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/benjaminwhite/django-
trunk/django/core/management/__init__.py", line 427, in
execute_from_command_line
utility.execute()
File "/Users/benjaminwhite/django-
trunk/django/core/management/__init__.py", line 391, in execute
django.setup()
File "/Users/benjaminwhite/django-trunk/django/__init__.py", line 21, in
setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
105, in populate
app_config.import_models(all_models)
File "/Users/benjaminwhite/django-trunk/django/apps/base.py", line 180,
in import_models
self.models_module = import_module(models_module_name)
File
"/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/importlib/__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in
module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in
_call_with_frames_removed
File "/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/site-
packages/tastypie/models.py", line 32, in <module>
from tastypie.compat import AUTH_USER_MODEL
File "/Users/benjaminwhite/.virtualenvs/HUMAN_WRITES/lib/python3.3/site-
packages/tastypie/compat.py", line 14, in <module>
User = get_user_model()
File "/Users/benjaminwhite/django-
trunk/django/contrib/auth/__init__.py", line 133, in get_user_model
user_model = apps.get_model(app_label, model_name)
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
182, in get_model
self.check_ready()
File "/Users/benjaminwhite/django-trunk/django/apps/registry.py", line
118, in check_ready
raise RuntimeError("App registry isn't ready yet.")
RuntimeError: App registry isn't ready yet.

}}}

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

Django

unread,
Jan 26, 2014, 2:17:27 AM1/26/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
-------------------------------------+-------------------------------------
Reporter: benjamin.e.white1@… | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version:
Severity: Normal | 1.7-alpha-1
Keywords: Django-Tastypie, | Resolution:
python3 | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by loic84):

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


Comment:

Out of curiosity, does `'tastypie'` appear before `'django.contrib.auth'`
in `settings.INSTALLED_APPS`?

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

Django

unread,
Jan 26, 2014, 2:45:18 AM1/26/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
-------------------------------------+-------------------------------------
Reporter: benjamin.e.white1@… | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version:
Severity: Normal | 1.7-alpha-1
Keywords: app-loading | Resolution:
tastypie | 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):

* keywords: Django-Tastypie, python3 => app-loading tastypie
* component: Uncategorized => Documentation
* stage: Unreviewed => Accepted


Comment:

As implied here:
https://docs.djangoproject.com/en/dev/topics/auth/customizing
/#referencing-the-user-model the User module should be referenced by
`settings.AUTH_USER_MODEL` at import time. get_user_model() doesn't work
until the initialization sequence is complete.

We could clarify this section of the docs again, and also say something in
the release notes. But the fix belongs to tastypie.

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

Django

unread,
Jan 26, 2014, 12:02:06 PM1/26/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
-------------------------------------+-------------------------------------
Reporter: benjamin.e.white1@… | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version:
Severity: Normal | 1.7-alpha-1
Keywords: app-loading | Resolution:
tastypie | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

Related thread: https://groups.google.com/d/msg/django-
developers/lmT1JxsWHPo/N2V9U5SN9gwJ

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

Django

unread,
Mar 10, 2014, 4:12:55 PM3/10/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
-------------------------------------+-------------------------------------
Reporter: benjamin.e.white1@… | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version:
Severity: Normal | 1.7-alpha-1
Keywords: app-loading | Resolution:
tastypie | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/2416

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

Django

unread,
Mar 10, 2014, 4:19:44 PM3/10/14
to django-...@googlegroups.com
#21875: Runtime Error with Django-Tastypie: "App registry isn't ready yet."
-------------------------------------+-------------------------------------
Reporter: benjamin.e.white1@… | Owner: nobody
Type: Bug | Status: closed

Component: Documentation | Version:
Severity: Normal | 1.7-alpha-1
Keywords: app-loading | Resolution: fixed

tastypie | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Aymeric Augustin <aymeric.augustin@…>):

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


Comment:

In [changeset:"1be31c320c2e0efa1730f73509d64e024ab31a0c"]:
{{{
#!CommitTicketReference repository=""
revision="1be31c320c2e0efa1730f73509d64e024ab31a0c"
Fixed #21875 -- Clarified that get_user_model() only works at run time.

Thanks Benjamin White for the report.
}}}

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

Reply all
Reply to author
Forward
0 new messages