django报错"doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."的解决办法

报错原因:

1.settings文件中没有注册app

2.如果注册了,就是django没有识别出来

 

解决办法:

1.注册app

2.导入models时使用绝对导入

将相对导入方式:

from .models import 表名

 

改为:

from app.models import 表名

 

posted @ 2024-01-18 16:21  wellplayed  阅读(247)  评论(0编辑  收藏  举报