[Django]-Django.core.exceptions.ImproperlyConfigured: Cannot import 'category'. Check that 'api.category.apps.CategoryConfig.name' is correct

9👍

Try to change name in your category apps.py like this

class CategoryConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'api.category'

3👍

AppConfig.name is a full python path to the application.
in your case your app category is inside another app called api so try to change your apps.py file to this :

class CategoryConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'api.category' // full path to your app category

the source from django documentation : https://docs.djangoproject.com/en/4.0/ref/applications/#django.apps.AppConfig.name

👤monim

0👍

You will have to make api directory a package by creating a __init__.py file in it. Then instead of adding just api in INSTALLED_APPS list just add api.category.

Like this –

INSTALLED_APPS = [
     #other basic install
    'corsheaders',
    'rest_framework',
    'rest_framework.authtoken',
    'api.category',
]

Leave a comment