美文网首页
[Python] Model doesn't declare a

[Python] Model doesn't declare a

作者: objcat | 来源:发表于2021-04-16 16:34 被阅读0次

一.前言

今天无意中碰了django, 发现这个问题, 本来不想写的, 但是网上的解决方案写的都跟杂碎一样, 所以这里来声明一下

二.正文

这个问题经常出现于没有导入模块, 比如你在初始模块创建了个model

这时候你引入model它就会报错

RuntimeError: Model class test_django.User.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

解决方案是在settings.py中添加模块名

再次运行就解决了 - -

finally enjoy it.

by objcat

2021.04.09

相关文章

网友评论

      本文标题:[Python] Model doesn't declare a

      本文链接:https://www.haomeiwen.com/subject/mlcwkltx.html