Answer the question
In order to leave comments, you need to log in
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',
]
from django.apps import AppConfig
class MyAppConfig(AppConfig):
name = 'articles'
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question