0
0
0ldn0mad2020-02-11 02:12:10
Django
0ldn0mad, 2020-02-11 02:12:10

Why does an error occur during migration?

In django 3.0.3 set up simple models. I want to make a migration:
python3 manage.py makemigrations articles
but an error appears:
django.core.exceptions.ImproperlyConfigured: 'articles.apps.AppConfig' must supply a name attribute. (I can’t understand what attribute of the name is in question)
I understand that the error is somewhere in the names of the application, but I don’t understand which one.
Here is the settings.py file setup

import os
import sys

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

PROJECT_ROOT = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(PROJECT_ROOT, 'apps'))

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '!xa^x)#*nd0^n52al)[email protected]_&7_%&byq^2e#@midnzt'

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

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'articles.apps.AppConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

In this file, the IDE unhappily underlined the entry:
'articles.apps.AppConfig',

AND the contents of the apps.ru file

from django.apps import AppConfig

class MyAppConfig(AppConfig):
    name = 'articles'

And in this file it was underlined: 'articles'

Tell me, what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2021-09-29
@fox_12

INSTALLED_APPS should have something like this:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'articles',
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question