Django project running error Apps aren't loaded yet

I checked almost all the solutions to this error on the Internet, none of them . Ask my old friend to help me. I"m really going crazy.

the following is the detailed error message:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000000004C5AD90>
Traceback (most recent call last):
  File "E:\MyProgram\Anaconda\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "E:\MyProgram\Anaconda\lib\site-packages\django\core\management\commands\runserver.py", line 113, in inner_run
    autoreload.raise_last_exception()
  File "E:\MyProgram\Anaconda\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "E:\MyProgram\Anaconda\lib\site-packages\django\core\management\__init__.py", line 327, in execute
    autoreload.check_errors(django.setup)()
  File "E:\MyProgram\Anaconda\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "E:\MyProgram\Anaconda\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "E:\MyProgram\Anaconda\lib\site-packages\django\apps\registry.py", line 89, in populate
    app_config = AppConfig.create(entry)
  File "E:\MyProgram\Anaconda\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "E:\MyProgram\Anaconda\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\MyProgram\Anaconda\lib\site-packages\django\contrib\admin\models.py", line 5, in <module>
    from django.contrib.contenttypes.models import ContentType
  File "E:\MyProgram\Anaconda\lib\site-packages\django\contrib\contenttypes\models.py", line 134, in <module>
    class ContentType(models.Model):
  File "E:\MyProgram\Anaconda\lib\site-packages\django\db\models\base.py", line 100, in __new__
    app_config = apps.get_containing_app_config(module)
  File "E:\MyProgram\Anaconda\lib\site-packages\django\apps\registry.py", line 244, in get_containing_app_config
    self.check_apps_ready()
  File "E:\MyProgram\Anaconda\lib\site-packages\django\apps\registry.py", line 127, in check_apps_ready
    raise AppRegistryNotReady("Apps aren"t loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren"t loaded yet.

run the Django project in PyCharm, but it won"t run, and the above error occurs. But I have no problem switching to other Django projects I wrote before.

this project can also be run, but I can"t introduce xadmin. I make this mistake all the time.

I found a similar problem on StackOverflow:
https://stackoverflow.com/que...

but I still don"t know how to fix this problem.

my Django version is 2.0. Here is my settings:

"""
Django settings for MxShop_Back project.

Generated by "django-admin startproject" using Django 2.1.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os
import sys

-sharp Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

-sharp app
sys.path.insert(0, BASE_DIR)
sys.path.insert(0, os.path.join(BASE_DIR, "apps"))
sys.path.insert(0, os.path.join(BASE_DIR, "extra_apps"))

-sharp Quick-start development settings - unsuitable for production
-sharp See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

-sharp SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "77@0n19n67bs_8e-n6g%s&nfu(wl5h4-^pqadi9a+bf3e*!u@a"

-sharp SECURITY WARNING: don"t run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

-sharp Django
AUTH_USER_MODEL = "users.UserProfile"

-sharp Application definition

INSTALLED_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "rest_framework",
    "DjangoUeditor",
    "users.apps.UsersConfig",
    "goods.apps.GoodsConfig",
    "trade.apps.TradeConfig",
    "user_operations.apps.UserOperationsConfig",
    "crispy_forms",
    "xadmin",
    "django.contrib.admin.models.LogEntry",
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "MxShop_Back.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [os.path.join(BASE_DIR, "templates")]
        ,
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

WSGI_APPLICATION = "MxShop_Back.wsgi.application"

-sharp Database
-sharp https://docs.djangoproject.com/en/2.1/ref/settings/-sharpdatabases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.mysql",
        "NAME": "mxshop",
        "USER": "root",
        "PASSWORD": "3838438",
        "HOST": "127.0.0.1",
        "OPTIONS": {"init_command": "SET default_storage_engine=INNODB;"}
    }
}

-sharp Password validation
-sharp https://docs.djangoproject.com/en/2.1/ref/settings/-sharpauth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]

-sharp Internationalization
-sharp https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True

-sharp Static files (CSS, JavaScript, Images)
-sharp https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = "/static/"

the problem has been solved, record the solution:

first you need to add auto-registration models to url.py:

  here . 

Menu