Django:Can not load app config (Apps aren't loaded yet)

admin

Administrator
Staff member
I am following a <a href="https://impythonist.wordpress.com/2...or-building-restful-api-with-django-tastypie/" rel="nofollow noreferrer">tutorial</a> using python 3.5 and Django 1.10 to making a backend, but there is a problem I can not solve. This error also occurs in the author's code downloading from github.
I have been spending a day in this question, thank you for your time.

<h2>Error</h2>

Code:
Traceback (most recent call last):
File "manage.py", line 22, in &lt;module&gt;
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
File "&lt;frozen importlib._bootstrap&gt;", line 944, in _find_and_load_unlocked
File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed
File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
File "&lt;frozen importlib._bootstrap&gt;", line 673, in _load_unlocked
File "&lt;frozen importlib._bootstrap_external&gt;", line 665, in exec_module
File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed
File "/Users/Charles/djangop1/urban_tastes/services/apps.py", line 2, in &lt;module&gt;
from django.contrib.auth.models import User
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/contrib/auth/models.py", line 4, in &lt;module&gt;
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/contrib/auth/base_user.py", line 52, in &lt;module&gt;
class AbstractBaseUser(models.Model):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/db/models/base.py", line 105, in __new__
app_config = apps.get_containing_app_config(module)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/django/apps/registry.py", line 237, in get_containing_app_config
self.check_apps_ready()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/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.

<h2>app.py</h2>

Code:
from django.apps import AppConfig
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from tastypie.models import create_api_key

class ServicesConfig(AppConfig):
    name = 'services'
    def ready(self):
       # This line dispatches signal to Tastypie to create APIKey
       signals.post_save.connect(create_api_key, sender=User)

&lt;__init__.py&gt;
default_app_config = 'services.apps.ServiceConfig'

&lt;settings.py&gt;
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'tastypie',
    'services'
]