# Python Shell Apps aren't loaded yet

**URL:** <https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270>\
**Category:** Mystery Errors\
**Created:** [August 22, 2023, 7:16am UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270 "2023-08-22T07:16:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![HamzaMa96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/hamzama96/32/15291_2.png) [@HamzaMa96](https://forum.djangoproject.com/u/HamzaMa96)\
**Post date:** [August 22, 2023, 7:16am UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/1 "2023-08-22T07:16:30Z")

</div>

I am having the following issue when i try to write queries using python shell

```auto
from feed.models import video
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/app/feed/models.py", line 1, in <module>
    from users.models import NewUser, category
  File "/app/users/models.py", line 1, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 127, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 260, in get_containing_app_config
    self.check_apps_ready()
  File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 137, in check_apps_ready
    settings.INSTALLED_APPS
  File "/usr/local/lib/python3.10/site-packages/django/conf/ __init__.py", line 92, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python3.10/site-packages/django/conf/ __init__.py", line 72, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

```

then i solved this issue by writing this command in the terminal

```auto
export DJANGO_SETTINGS_MODULE=project.settings

```

then i got the following error

```auto
`from users.models import NewUser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/app/users/models.py", line 1, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.10/site-packages/django/db/models/base.py", line 127, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 260, in get_containing_app_config
    self.check_apps_ready()
  File "/usr/local/lib/python3.10/site-packages/django/apps/registry.py", line 138, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.`

```

---

<div class="post-metadata">

**Author:** ![addwebsolution](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/addwebsolution/32/23762_2.png) [@addwebsolution](https://forum.djangoproject.com/u/addwebsolution)\
**Post date:** [August 22, 2023, 7:31am UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/2 "2023-08-22T07:31:14Z")

</div>

This could be an issue with your Django settings, for example an app in INSTALLED\_APPS that didn’t exist. Once it was removed, it resolved the exception. Apps that can’t be imported for any reason will also raise an AppRegistryNotReady exception.

---

<div class="post-metadata">

**Author:** ![HamzaMa96](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/hamzama96/32/15291_2.png) [@HamzaMa96](https://forum.djangoproject.com/u/HamzaMa96)\
**Post date:** [August 22, 2023, 7:45am UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/3 "2023-08-22T07:45:20Z")

</div>

All apps in INSTALLED\_APPS are working

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 22, 2023, 12:17pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/4 "2023-08-22T12:17:36Z")

</div>

Three things to check:

1. Your current directory in the shell is the base directory of your project.

2. Your virtual environment for your project is active.

3. Are you trying to perform any ORM or database operations at the module level in your models.py file?

Also, please post your `INSTALLED_APPS` setting.

---

<div class="post-metadata">

**Author:** ![yanlkm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanlkm/32/18073_2.png) [@yanlkm](https://forum.djangoproject.com/u/yanlkm)\
**Post date:** [December 30, 2023, 6:22pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/5 "2023-12-30T18:22:33Z")

</div>

Hi,  
I got the same issue, there are my INSTALLED\_APP and my models.py :

```auto
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    "app.apps.AppConfig",
    'corsheaders',
    'django.core'
]

```

```auto
from django.db import models

# Create your models here.
from django.contrib.auth.models import AbstractUser

class User(AbstractUser):
    email = models.CharField(max_length=255, unique=True)
    password = models.CharField(max_length=255)
    bio = models.TextField(blank=True)
    date_of_birth = models.DateField(null=True, blank=True)
    profile_picture = models.ImageField(upload_to='profile_pics/', null=True, blank=True)

    first_name = None
    last_name = None
    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = []

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 30, 2023, 8:06pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/6 "2023-12-30T20:06:24Z")

</div>

- `django.core` should not be an entry in INSTALLED\_APPS.

- What version of Python are you using? What version of Django?

- What are the contents of your `app.apps.AppConfig` file?

- Please post the complete traceback from the error you are receiving.

---

<div class="post-metadata">

**Author:** ![yanlkm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanlkm/32/18073_2.png) [@yanlkm](https://forum.djangoproject.com/u/yanlkm)\
**Post date:** [December 30, 2023, 8:24pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/7 "2023-12-30T20:24:52Z")

</div>

Here is my complete traceback from the error I recieved :

```auto
Traceback (most recent call last):
  File "/home/yan/Documents/projet-py/applitest/manage.py", line 22, in <module>
    main()
  File "/home/yan/Documents/projet-py/applitest/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/yan/.local/lib/python3.10/site-packages/django/core/management/ __init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/yan/.local/lib/python3.10/site-packages/django/core/management/ __init__.py", line 382, in execute
    settings.INSTALLED_APPS
  File "/home/yan/.local/lib/python3.10/site-packages/django/conf/ __init__.py", line 89, in __getattr__
    self._setup(name)
  File "/home/yan/.local/lib/python3.10/site-packages/django/conf/ __init__.py", line 76, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/yan/.local/lib/python3.10/site-packages/django/conf/ __init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.10/importlib/ __init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/yan/Documents/projet-py/applitest/applitest/settings.py", line 18, in <module>
    import app.models
  File "/home/yan/Documents/projet-py/applitest/app/models.py", line 4, in <module>
    from django.contrib.auth.models import AbstractUser
  File "/home/yan/.local/lib/python3.10/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/home/yan/.local/lib/python3.10/site-packages/django/contrib/auth/base_user.py", line 58, in <module>
    class AbstractBaseUser(models.Model):
  File "/home/yan/.local/lib/python3.10/site-packages/django/db/models/base.py", line 129, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/home/yan/.local/lib/python3.10/site-packages/django/apps/registry.py", line 260, in get_containing_app_config
    self.check_apps_ready()
  File "/home/yan/.local/lib/python3.10/site-packages/django/apps/registry.py", line 138, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

```

I’m using the 3.10.6 version of Python and 5.0 of Django  
My `app.apps.AppConfig` file content is :

```auto
class AppConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'app'

```

Thank you for your response

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 30, 2023, 11:27pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/8 "2023-12-30T23:27:20Z")

</div>

Please show your settings.py file. (Feel free to obfuscate or remove sensitive values like secret keys or database passwords.)

---

<div class="post-metadata">

**Author:** ![yanlkm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanlkm/32/18073_2.png) [@yanlkm](https://forum.djangoproject.com/u/yanlkm)\
**Post date:** [January 1, 2024, 8:46pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/9 "2024-01-01T20:46:09Z")

</div>

Here is my `settings.py` file :

```auto
"""
Django settings for applitest project.

Generated by 'django-admin startproject' using Django 5.0.

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

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

from pathlib import Path

import django.core.exceptions
from django import core

import app.models
import applitest

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path( __file__ ).resolve().parent.parent

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-^1((po#y3ent(6^rn4*3qrwdi@^ab^8+-u&q93c-6v#5^4tu73'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    "app.apps.AppConfig",
    'corsheaders',
    'django.core'
]

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

ROOT_URLCONF = 'applitest.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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 = 'applitest.wsgi.application'

# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': ' ******',
        'USER': ' *****',
        'PASSWORD': ' *****',
        'HOST': ' ******',
        'PORT': ' ******',
    }
}

# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-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',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

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

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

AUTH_USER_MODEL = 'app.User'

```

(Happy new Year)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 1, 2024, 8:48pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/10 "2024-01-01T20:48:21Z")

</div>

> [@yanlkm](#):
>
> `import app.models`

This is the problem. You cannot import any models into the settings file. (This also means that you cannot use any models in your settings, but I don’t see any instances of _that_ here.)

---

<div class="post-metadata">

**Author:** ![yanlkm](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanlkm/32/18073_2.png) [@yanlkm](https://forum.djangoproject.com/u/yanlkm)\
**Post date:** [January 1, 2024, 9:07pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/11 "2024-01-01T21:07:51Z")

</div>

Thank you very much for your help !

---

<div class="post-metadata">

**Author:** ![Yanohterry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanohterry/32/20579_2.png) [@Yanohterry](https://forum.djangoproject.com/u/Yanohterry)\
**Post date:** [April 12, 2024, 1:44pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/12 "2024-04-12T13:44:45Z")

</div>

hi.  
please i’m getting a similar error while running my code.

C:\Users\ftefo\PycharmProjects\pythonProject1.venv\Scripts\python.exe C:\Users\ftefo\PycharmProjects\pythonProject1\myproject\myapp\models.py  
  
Traceback (most recent call last):  
File “C:\Users\ftefo\PycharmProjects\pythonProject1\myproject\myapp\models.py”, line 11, in   
class MotorData(models.Model):  
File “C:\Users\ftefo\PycharmProjects\pythonProject1.venv\lib\site-packages\django\db\models\base.py”, line 129, in **new**  
app\_config = apps.get\_containing\_app\_config(module)  
File “C:\Users\ftefo\PycharmProjects\pythonProject1.venv\lib\site-packages\django\apps\registry.py”, line 260, in get\_containing\_app\_config  
self.check\_apps\_ready()  
File “C:\Users\ftefo\PycharmProjects\pythonProject1.venv\lib\site-packages\django\apps\registry.py”, line 138, in check\_apps\_ready  
raise AppRegistryNotReady(“Apps aren’t loaded yet.”)  
django.core.exceptions.AppRegistryNotReady: Apps aren’t loaded yet.

Process finished with exit code 1

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 12, 2024, 1:48pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/13 "2024-04-12T13:48:44Z")

</div>

Side note: When posting code, templates, or error messages here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

Please see the post above at [Python Shell Apps aren't loaded yet - #4 by KenWhitesell](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/4)

---

<div class="post-metadata">

**Author:** ![Yanohterry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanohterry/32/20579_2.png) [@Yanohterry](https://forum.djangoproject.com/u/Yanohterry)\
**Post date:** [April 12, 2024, 1:57pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/14 "2024-04-12T13:57:54Z")

</div>

ok thanks. actually new here and also new with django.

this is my INSTALLED\_APPS:

```auto
 INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.core',
    'myapp.apps.MyappConfig',
]

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 12, 2024, 2:04pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/15 "2024-04-12T14:04:37Z")

</div>

Welcome!

That addresses one of the questions, what about the other two?

Also, why do you have `django.core` in your INSTALLED\_APPS? It’s not an app.

You mention that you’re new to Django - have you worked your way through either the [Official Django Tutorial](https://docs.djangoproject.com/en/4.2/intro/tutorial01/) or the [Django Girls Tutorial](https://tutorial.djangogirls.org/en/)? They’re the best places to get started.

---

<div class="post-metadata">

**Author:** ![Yanohterry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanohterry/32/20579_2.png) [@Yanohterry](https://forum.djangoproject.com/u/Yanohterry)\
**Post date:** [April 12, 2024, 2:07pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/16 "2024-04-12T14:07:57Z")

</div>

I saw the django.core in the previous persons intalled\_apps, so I added it hoping it could help.  
here is the current directory of my shell, and it seems to me that my virtual environment is activated :  
`(.venv) PS C:\Users\ftefo\PycharmProjects\pythonProject1\myproject>`

---

<div class="post-metadata">

**Author:** ![Yanohterry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanohterry/32/20579_2.png) [@Yanohterry](https://forum.djangoproject.com/u/Yanohterry)\
**Post date:** [April 12, 2024, 2:10pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/17 "2024-04-12T14:10:46Z")

</div>

i have worked through the the Official Django Tutorial and some youtube tutorials also but i couldn’t fne any solution for the current error

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 12, 2024, 2:11pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/18 "2024-04-12T14:11:12Z")

</div>

How are you running your project?

---

<div class="post-metadata">

**Author:** ![Yanohterry](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/yanohterry/32/20579_2.png) [@Yanohterry](https://forum.djangoproject.com/u/Yanohterry)\
**Post date:** [April 12, 2024, 2:13pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/19 "2024-04-12T14:13:32Z")

</div>

i’m running my project using the run button in pycharm  
hope this answers the question

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 12, 2024, 2:14pm UTC](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270/20 "2024-04-12T14:14:00Z")

</div>

What command is it issuing?

[Next page](https://forum.djangoproject.com/t/python-shell-apps-arent-loaded-yet/23270.md?page=2)
