Как решить проблему с классом модели django.contrib.contenttypes.models.ContentType

RuntimeError: Класс модели django.contrib.contenttypes.models.ContentType не объявляет явную метку app_label и не находится в приложении в INSTALLED_APPS.

И

LookupError: Нет установленного приложения с ярлыком 'admin'.

Это ошибки, с которыми я столкнулся, поэтому, пожалуйста, помогите мне решить обе проблемы.

Ошибка есть

Traceback (most recent call last):
  File "A:\Projects\ePlant\eplant_dj\manage.py", line 22, in <module>
    main()
  File "A:\Projects\ePlant\eplant_dj\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\core\management\__init__.py", line 382, in execute
    settings.INSTALLED_APPS
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\conf\__init__.py", line 89, in __getattr__
    self._setup(name)
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\conf\__init__.py", line 76, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\conf\__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ateyu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "A:\Projects\ePlant\eplant_dj\eplant_dj\settings.py", line 11, in <module>
    from account.authentication import CustomJWTAuthentication
  File "A:\Projects\ePlant\eplant_dj\account\authentication.py", line 1, in <module>
    from rest_framework_simplejwt.authentication import JWTAuthentication
  File "A:\Projects\ePlant\venv\Lib\site-packages\rest_framework_simplejwt\authentication.py", line 4, in <module>        
    from django.contrib.auth.models import AbstractBaseUser
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\contrib\auth\models.py", line 5, in <module>
    from django.contrib.contenttypes.models import ContentType
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\contrib\contenttypes\models.py", line 139, in <module>
    class ContentType(models.Model):
  File "A:\Projects\ePlant\venv\Lib\site-packages\django\db\models\base.py", line 134, in __new__
    raise RuntimeError(
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

мой Settings.py это

import django
django.setup()
from django.core.management.utils import get_random_secret_key
import sys
# import dj_database_url
from os import getenv, path
from pathlib import Path
from django.core.management.utils import get_random_secret_key
import dotenv
import random




ALLOWED_HOSTS = ["*"]


# BASE_URL = getenv("BASE")
BASE_DIR = Path(__file__).resolve().parent. Parent

dotenv_file = BASE_DIR / '.env.local'

if path.isfile(dotenv_file):
    dotenv.load_dotenv(dotenv_file)

DEVELOPMENT_MODE = 'True'

SECRET_KEY = getenv("DJANGO_SECRET_KEY", get_random_secret_key())

DEBUG = 'True'



# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myapps.apps.MyappsConfig',
    'account.apps.AccountConfig',
    'rest_framework',
    'rest_framework.authtoken',
    # 'djoser',
    'corsheaders',
    # 'social_django',
    'phonenumber_field',
]

Пожалуйста, помогите мне!!!

Вернуться на верх