django.core.exceptions.ImproperlyConfigured: Cannot import 'blog'. Check that 'apps.blog.apps.Blo...

报错信息:

django.core.exceptions.ImproperlyConfigured: Cannot import 'blog'. Check that 'apps.blog.apps.BlogConfig.name' is correct.

问题描述:

django创建子应用,使用的是`django-admin startapp`

注册应用`INSTALLED_APPS = [, 'apps.blog',]`子应用在apps包下

解决问题:

报错信息,结合搜索,是说`blog.apps`文件

class BlogConfig(AppConfig):

    default_auto_field = 'django.db.models.BigAutoField'

    name = 'blog'

name='blog'改为 name='apps.blog'

apps包下的子应用名称

你可能感兴趣的:(django.core.exceptions.ImproperlyConfigured: Cannot import 'blog'. Check that 'apps.blog.apps.Blo...)