Apps aren't loaded yet. with signals

In django 1.9

# it is not need edit __init__.py

apps.py

from django.apps import AppConfig

class YourAppConfig(AppConfig):

    name = 'your_app_name'
    verbose_name = 'Your App Name' # optional

    def ready(self):
        from your.app.path import signals # import your signals.py

settings.py

# include path to YourAppConfig class:

INSTALLED_APPS = [
    'your_app.apps.YourAppConfig',
    # ...,
]

see django docs


Try registering signals when the app first loads.

In you __init.py__ file:

default_app_config = 'yourappname.apps.YourAppConfig'

In apps.py of the app:

from django.apps import AppConfig


class YourAppConfig(AppConfig):
    name = 'yourappname'

    def ready(self):
        from yourappname import signals

Do this for every app involved in registering signals.

Read this for more info.


There are several things to try:

  • remove "from django.contrib.auth import get_user_model" has you don't use it anyway and it doesn't work before the app is loaded. I don't know if importing alone triggers the issue or if you have ot use it, but better safe than sorry.
  • if you have a models packages (a dir with init.py) instead of a models.py file, then you need to declare explicitly app_label in every model you use in their "class Meta".
  • if none of that work, try to move the code you think causes that in the application config ready method.

E.G:

from django.apps import AppConfig


class ProductsConfig(AppConfig):
    name = 'your_app_name'

    def ready(self):
        YourModel = self.get_model('YourModel')
        # do stuff with the model

BTW: Models, as all classes, are better named without underscores such as Profile_User => ProfileUser.

Good luck !