New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data_collector changes for django >= 1.7 #1556

MFlyer opened this Issue Nov 30, 2016 · 0 comments


None yet
2 participants

MFlyer commented Nov 30, 2016

Hi @schakrava , need your help / confirmation for upcoming PR:

While checking Pincard manager after Django update got this while trying to create a new pincard (credit card symbol on users page clicked):

Traceback (most recent call last):
  File "/opt/build/eggs/gevent-1.1.2-py2.7-linux-x86_64.egg/gevent/", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/opt/build/src/rockstor/smart_manager/", line 96, in create_pincard
    new_pincard = save_pincard(uid)
  File "/opt/build/src/rockstor/system/", line 171, in save_pincard
  File "/opt/build/src/rockstor/system/", line 163, in flush_pincard
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 536, in delete
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 193, in collect
    if self.can_fast_delete(objs):
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 155, in can_fast_delete
    for related in get_candidate_relations_to_delete(opts):
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 62, in get_candidate_relations_to_delete
    opts.get_fields(include_hidden=True) for opts in candidate_models
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 62, in <genexpr>
    opts.get_fields(include_hidden=True) for opts in candidate_models
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 740, in get_fields
    return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 802, in _get_fields
    all_fields = self._relation_tree
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/utils/", line 59, in __get__
    res = instance.__dict__[] = self.func(instance)
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 709, in _relation_tree
    return self._populate_directed_relation_graph()
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/db/models/", line 681, in _populate_directed_relation_graph
    all_models = self.apps.get_models(include_auto_created=True)
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/utils/", line 101, in wrapper
    result = user_function(*args, **kwds)
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/apps/", line 168, in get_models
  File "/opt/build/eggs/Django-1.8.16-py2.7.egg/django/apps/", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
AppRegistryNotReady: Models aren't loaded yet.
<Greenlet at 0x22e8cd0: create_pincard(u'11201')> failed with AppRegistryNotReady

Googling found that it's related to Django >=1.7 and solved over system.pinmanager this with:

import django

Pinmanager code inside data_collector (remember data_collector is supervisord, not on our wsgi) relies on system.pinmanager that loads Django User model (from django.contrib.auth.models import User as DjangoUser), but django.setup() now seems to be required

Can you confirm this being ok? :)

Meanwhile, having PR

@schakrava schakrava closed this in 1af716c Dec 4, 2016

schakrava added a commit that referenced this issue Dec 4, 2016

@schakrava schakrava added the bug label Dec 4, 2016

@schakrava schakrava added this to the Pinnacles milestone Dec 4, 2016

@schakrava schakrava changed the title from [Bug] Upgrading to Django >= 1.7 requires enabling Django on data_collector to data_collector changes for django >= 1.7 Dec 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment