Jay Cee Jay Cee - 2 months ago 36
Python Question

Django 1.10 AppRegistryNotReady: Apps aren't loaded yet. I can't use django.setup

I'm facing an issue since I upgraded my django from

1.7.10
to
1.10.1
.
Indeed, I had the
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

Error and in order to solve that I figured out that I had to remove django.setup() in order to solve the circular dependency (I assume).
But then, I'm facing the error from the title:

```

Traceback (most recent call last):
File "/var/www/webapps/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run
autoreload.raise_last_exception()
File "/var/www/webapps/lib/python3.4/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/var/www/webapps/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/var/www/webapps/lib/python3.4/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/var/www/webapps/lib/python3.4/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/var/www/webapps/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/var/www/webapps/lib/python3.4/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/var/www/webapps/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1448, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/var/www/webapps/lib/python3.4/site-packages/easy_select2/__init__.py", line 7, in <module>
from easy_select2.utils import (
File "/var/www/webapps/lib/python3.4/site-packages/easy_select2/utils.py", line 7, in <module>
from easy_select2.widgets import Select2Mixin, Select2, Select2Multiple
File "/var/www/webapps/lib/python3.4/site-packages/easy_select2/widgets.py", line 24, in <module>
static('easy_select2/js/init.js'),
File "/var/www/webapps/lib/python3.4/site-packages/django/templatetags/static.py", line 163, in static
return StaticNode.handle_simple(path)
File "/var/www/webapps/lib/python3.4/site-packages/django/templatetags/static.py", line 112, in handle_simple
if apps.is_installed('django.contrib.staticfiles'):
File "/var/www/webapps/lib/python3.4/site-packages/django/apps/registry.py", line 225, in is_installed
self.check_apps_ready()
File "/var/www/webapps/lib/python3.4/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.


And the "apps registrations":

# APP CONFIGURATION
DJANGO_APPS = (
# Default Django apps:
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
# Useful template tags:
# 'django.contrib.humanize',
)

THIRD_PARTY_APPS = (
# Admin
'djangocms_admin_style',
'djangocms_text_ckeditor',
'django.contrib.admin',

# Django CMS
'cms',
'menus',
'sekizai',
'treebeard',

'easy_thumbnails',
'easy_thumbnails.optimize',
'filer',
'rosetta',
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_link',
'cmsplugin_filer_image',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
#'cmsplugin_filer_svg',
# 'djangocms_ckeditor_filer',
'djangocms_style',
'djangocms_flash',
'djangocms_googlemap',
'djangocms_inherit',

'reversion',
'aldryn_reversion',
'parler',
'taggit',
'meta',
'meta_mixin',
'cities_light',
'admin_enhancer',
'multiselectfield',# multiselect in charfield
'sortedm2m',# ordered manyTomany
'easy_select2',
'taggit_autosuggest_select2',
'adminsortable2',
'autocomplete_light',
'compressor',
'nocaptcha_recaptcha',
'widget_tweaks',
'qartez',
'django_mobile',
'cookielaw',
'django_user_agents',
)

# Apps specific for this project go here.
LOCAL_APPS = (
'blippar',
'multisite_multilanguage',
'djangocms_extend',
'djangocms_blog',
'djangocms_showroom',
'djangocms_press',
'djangocms_partner_profile',
'djangocms_faq',
'djangocms_presentations',
'djangocms_projects',

# plugins
'blippbutton',
'blippvideo',
'djangocms_column',
'djangocms_footer',
'djangocms_office',
'djangocms_contact',
'djangocms_partner',
'djangocms_job',
'djangocms_image',
'djangocms_commons',
'djangocms_casestudies',
'djangocms_presentations_cases',
'djangocms_testimonial',
# Your stuff: custom apps go here
)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
# END APP CONFIGURATION


Which I don't know how to solve now. Does anyone have an idea on it?

Answer

You are hitting this issue. The answer appears to be to upgrade your version of easy_select2.

The issue is fixed in easy_select2 1.3.2+. Note that the changelog says that there are backwards incompatible changes in 1.3.

Comments