Hi.

In your app __init__.py you import signals which in turn imports User model.


You can't do that any more.

Correct way to register signal handlers is to use app config ready.

See
https://docs.djangoproject.com/en/1.9/topics/signals/#connecting-receiver-functions

And section "where this code should live?".


28.2.2018 7.52 ip. "OliveTree" <[email protected]> kirjoitti:

I am upgrading from django 1.8.4 to 1.9.13. I installed django 1.9.3 and my
application stops working, it displays the following error:


Unhandled exception in thread started by <function
check_errors.<locals>.wrapper at 0x7effd13cbbf8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 226, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/core/
management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 249, in raise_last_exception
    six.reraise(*_exception)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line
685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py",
line 226, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/__init__.py", line
18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py",
line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line
90, in create
    module = import_module(entry)
  File "/usr/lib/python3.4/importlib/__init__.py", line 109, in
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, 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 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in
_call_with_frames_removed
  File "/home/me/work/test_upgrade_django_to_1_11/be/myapp/__init__.py",
line 1, in <module>
    import myapp.signals
  File "/home/me/work/test_upgrade_django_to_1_11/be/myapp/signals.py",
line 6, in <module>
    from django.contrib.auth.models import User
  File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/models.py",
line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser,
BaseUserManager
  File 
"/usr/local/lib/python3.4/dist-packages/django/contrib/auth/base_user.py",
line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py",
line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py",
line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/usr/local/lib/python3.4/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.

In my setting I have:
(...)
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'myapp',
    #'debug_toolbar',
    'django_extensions',
    'corsheaders',
    'watson',
    'raven.contrib.django.raven_compat',
    #'django.contrib.admindocs',
    'django_mailbox',
    'django.contrib.postgres', )
(...)

I'm using python3.4 and postgresql9.3

-- 
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/
msgid/django-users/45a9eef2-abea-4bcc-b4e9-5f735ed1e4c7%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/45a9eef2-abea-4bcc-b4e9-5f735ed1e4c7%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe4OKhUyG__2DM8Ug-MHk5qxG9X%2BUdcAtR%2B8cXVOMzynQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to