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.
* 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>
* 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>
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>
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/2416
--
Ticket URL: <https://code.djangoproject.com/ticket/21875#comment:4>
* 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>