码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2020-03-12 18:58:24      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:pre   情况下   报错   rom   xpl   django   imp   环境   方式   



运行环境
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't in an application in INSTALLED_APPS.

标签:pre   情况下   报错   rom   xpl   django   imp   环境   方式   

原文地址:https://www.cnblogs.com/ludundun/p/12470832.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!