报错RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn&

Posted 大海一个人听

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报错RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn&相关的知识,希望对你有一定的参考价值。



运行环境
PyCharm 2017.1
Django 2.0.1
python 3.6.1

使用相对路径引用Models模块
from .models import *
1
在同时存在多个apps的情况下,有机会报错

RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
1
解决办法
使用绝对路径引用 以后不能采用点的方式了

from app_name.models import *
————————————————


以上是关于报错RuntimeError: Model class apps.user.models.User doesn't declare an explicit app_label and isn&的主要内容,如果未能解决你的问题,请参考以下文章

Keras 编码器-解码器模型 RuntimeError: You must compile your model before using it

python递归深度报错--RuntimeError: maximum recursion depth exceeded

python 报错RuntimeError: dictionary changed size during iteration

RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR

jupyter 报错 raise RuntimeError(‘This event loop is already running‘)

jupyter 报错 raise RuntimeError(‘This event loop is already running‘)