Django开发学习BUG记录--RemovedInDjango19Warning:Model class apps.user.models.User doesn't declare an explicit app_label
报错信息:
/home/python/PycharmProjects/dailyfresh/apps/user/models.py:8: RemovedInDjango19Warning: Model class apps.user.models.User doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
- 报错解析:apps.user.models 没有声明
原因:当时创建项目时为了简化注册app的写法,所以在setting中加入了apps的路径
sys.path.insert(0, os.path.join(BASE_DIR,'apps'))
然后注册app时就不用apps.
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'tinymce',
'cart',
'goods',
'order',
'user',
)
但是当在user.views导入user.models时直接导入
from user.models import User
按这样导入pycharm会有红色波浪线提示,所以又改回原始写法
from apps.user.models import User
这样开启服务器后就会出现上面的报错
这样就会导致Django注册时app为user,但导入使用时是apps.user,所以Django没有找到对应声明的app所以报错
- 解决方法:
方法1.忽略pycharm报错,还是直接导入
from user.models import User
方法2:注册app时不简化写法时用apps.注册
Django开发学习BUG记录--RemovedInDjango19Warning:Model class apps.user.models.User doesn't declare an explicit app_label的更多相关文章
- RuntimeError: Model class apps.users.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
报错代码: File "/home/bsodgm/Desktop/Django_projection/mall/apps/users/views.py", line 9, in & ...
- Model class apps.goods.models.GoodsType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
在admin.py注册这个model时,报了个错: RuntimeError: Model class apps.goods.models.GoodsType doesn't declare an e ...
- 在views中引用UserProfile报错RuntimeError: Model class apps.users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
如图报错,在settings中,该加的也加了啊! 显然类似于网上最容易遇到的解决方案如下图,是没有任何意义的 只要在view中有 from .models import UserProfile,Ver ...
- Django开发BUG "Model class WH_auth.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."
当进行数据库迁移的时候发生问题,报错如下:RuntimeError: Model class WH_auth.models.User doesn't declare an explicit app_l ...
- RuntimeError: Model class app_anme.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.---python学习错误记录
untimeError: Model class app_anme.models.User doesn't declare an explicit app_label and isn't in an ...
- django.db.utils.ProgrammingError: (1146, "Table 'db_gold.user_ip_info' doesn't exist") RuntimeError: Model class scanhosts.models.HostLoginInfo doesn't declare an explicit app_label and isn't in an a
Error Msg 创建了一个apps的目录将所有app放入apps文件中, 将apps路径加入sys.path中:sys.insert(0, os.path.join(BASE_DIR, " ...
- Django RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.报错
报错内容 RuntimeError: Model class app_anme.models.Ad doesn't declare an explicit app_label and isn't in ...
- RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Django启动的时候报错 File "/home/hehecat/PycharmProjects/MxShop/MxShop/urls.py", line 23, in from ...
- RuntimeError: Model class user.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Django 2.x版本迁移数据库报这个错误,user表使用的Django的验证系统 本来就想改一下用户表的表名,莫名的报了个这个错误,在网上找到了解决办法 打开user应用模块下的apps.py文件 ...
随机推荐
- 【UR #2】跳蚤公路
[UR #2]跳蚤公路 参照yjc方法.也就是地铁环线那个题. 求每个点不在负环内的x的取值范围.然后所有1到j能到i的j的范围取交.得到答案. 每个边形如kx+b的直线,每个环也是 每个点不在负环内 ...
- [7.19NOIP模拟测试6]失恋三连(雾 题解
题面(加密) 不得不说这次的题除了引起单身汪极度不适之外还是出的很有水平的…… A. 很好的dp题 模型非常简单,如果数据范围足够友好的话就是一道dp入门题 30%: 我们可以设$dp[i][j]$为 ...
- (转)Linux C 多线程编程----互斥锁与条件变量
转:http://blog.csdn.net/xing_hao/article/details/6626223 一.互斥锁 互斥量从本质上说就是一把锁, 提供对共享资源的保护访问. 1. 初始化: 在 ...
- Spring定时器的使用方法
Spring定时器主要通过Quartz Cron表达式来实现定时任务,注解用法如下: # 每月的最后1天 @Scheduled(cron = "0 0 18 28–31 * ?") ...
- 带头结点的循环单链表----------C语言
/***************************************************** Author:Simon_Kly Version:0.1 Date: 20170520 D ...
- 19、Linux命令对服务器内存进行监控
国际惯例,我们要知道什么是服务器的内存,内存有哪些作用.这里就不做过多介绍,Linux性能监控需要我们对底层要有一定的理解.下面我将会列出我常用的监控内存的工具. vmstat vmstat显示关于进 ...
- 数据挖掘 FP-tree算法C++实现及源码
FP-growth挖掘算法 步骤一 扫描数据库,扫描数据库一次,得到频繁1-项集,把项按支持度递减排序,再一次扫描数据库,建立FP-tree 步骤二 对每个项,生成它的 条件模式库 步骤三 用条件模式 ...
- 面向对象(三)——组合、多态、封装、property装饰器
组合.多态.封装.property装饰器 一.组合 1.什么是组合 组合指的是某一个对象拥有一个属性,该属性的值是另外一个类的对象 class Foo(): pass class Bar(): pas ...
- 详解Telecom
学习目标: 掌握Telecom入口和分析方法 总结和演进Telecom交互模型 掌握Listener消息回调机制 学习CallsManager 为什么选择Telecom分析? 这是由于在Android ...
- mongo之find结果对象map实例处理
find 找到结果对象列表 res = await SS_StudentsLeaveTask.find(filter=_filter) self.resData = map(lambda x: str ...