Opened 8 years ago

Closed 8 years ago

#27033 closed Uncategorized (wontfix)

static tag causes AppRegistryNotReady errors on 1.10

Reported by: Florian Apolloner Owned by: nobody
Component: contrib.staticfiles Version: 1.10
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Florian Apolloner)

See the trace:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/anon/.local/lib/python2.7/site-packages/easy_select2/__init__.py", line 7, in <module>
    from easy_select2.utils import (
  File "/home/anon/.local/lib/python2.7/site-packages/easy_select2/utils.py", line 6, in <module>
    from easy_select2.widgets import Select2Mixin, Select2, Select2Multiple
  File "/home/anon/.local/lib/python2.7/site-packages/easy_select2/widgets.py", line 16, in <module>
    static('easy_select2/js/easy_select2.js'),
  File "/usr/local/lib/python2.7/dist-packages/django/templatetags/static.py", line 163, in static
    return StaticNode.handle_simple(path)
  File "/usr/local/lib/python2.7/dist-packages/django/templatetags/static.py", line 112, in handle_simple
    if apps.is_installed('django.contrib.staticfiles'):
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 225, in is_installed
    self.check_apps_ready()
  File "/usr/local/lib/python2.7/dist-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.

Marking as RB till we know how we want to handle it. Do we have a way to check if the app is installed without triggering app registry ready checks?

Change History (4)

comment:1 by Florian Apolloner, 8 years ago

Description: modified (diff)

comment:2 by Claude Paroz, 8 years ago

Seems like the more recent easy_select2 doesn't suffer from this any more (https://github.com/asyncee/django-easy-select2/commit/8b9a4f050166).

If we really want to be able to use static() before/during app population we could catch the exception and return some lazy object. Not sure about that.

At a minimum, release notes should be updated.

comment:3 by Tim Graham, 8 years ago

I think the use case of the project is obsoleted by the commit that caused the regression: cf546e11ac76c8dec527e39ff8ce8249a195ab42 allows form Media to use staticfiles automatically without having to call static() on each file. If we have to add a release note about this, I suggest something like "django.templatetags.static.static() now raises AppRegistryNotReady if called at application loading time." I think it's likely to be a rare issue and probably wouldn't happen in django-easy-select2 if convenience imports weren't provided in the project's __init__.py.

comment:4 by Florian Apolloner, 8 years ago

Resolution: wontfix
Status: newclosed

Seems legit, just wanted another opinion :D

Note: See TracTickets for help on using tickets.
Back to Top