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文件,这是没修改前的
from django.apps import AppConfig class UserConfig(AppConfig):
name = 'apps.user'
然后修改name值,去掉前边的apps.如下
from django.apps import AppConfig class UserConfig(AppConfig):
name = 'user'
只是找到了这个解决办法,但是具体的原因还不明了!如果还有问题,看下面
错误又来了,这次是goods商品模块
RuntimeError: Model class goods.models.GoodsType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
网上查了俩小时,各种办法都试了,改settings、goods/models、goods/apps、goods/views,各种改还是不行。
注意:最后我发现只要goods应用里的视图urls不导入views里的类视图就可以启动测试服务器了
我原先在goods/views.py里导入类视图的方式: from .views import IndexView
然后我改了下导入的方式: from apps.goods/views ,这下竟然不抛出异常了,奇迹
但是我还是不知道为什么,明明我 user应用里就是 from .views import 类视图,就没事,goods应用就有问题,没谁了真是
更奇葩的是,这会我goods里面的apps没有改name值,也不能改
from django.apps import AppConfig class GoodsConfig(AppConfig):
name = 'apps.goods'
我现在只能是,有错误疯狂的各种试验那种不报错,实在是累
希望有大神能知道这些奇葩问题的原因!
RuntimeError: Model class user.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.的更多相关文章
- 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 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 ...
- RuntimeError: Model class myapp.models.Test doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
没有添加子应用在settings里面!
- 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 ...
- 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, " ...
- 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 ...
随机推荐
- ERROR 1130 (HY000): Host 'test177' is not allowed to connect to this MySQL server
异常 在测试环境新搭建的MySQL服务端,启动后登陆MySQL如下异常: [root@test177 ~]# mysql -u root -po2jSLWw0ni -h test177 mysql: ...
- [笔记]C++下的数组声明
/* 例子来源于<C++ Primer> */ ]; //prts是含有10个整数类型指针的数组 ]; //错误,没有引用的数组 ]; //指向有10个整型元素数组的指针 ]; //引用有 ...
- python-matplotlib-ERROR
在导入包显示画图时,出错:ImportError: No module named '_tkinter 解决办法:通常原因是tkinter和tk-devel缺失 ERROR: matplotlib的图 ...
- Ranger使用solrCloud存储审计日志
Ranger使用solrCloud存储审计日志 标签(空格分隔): Ranger 1, Zookeeper 搭建 1,忽略.默认已经搭建好zk 集群. VECS17820:2181,VECS17821 ...
- CLOB、BLOB , CLOB与BLOB的区别
CLOB 定义 数据库中的一种保存文件所使用的类型. Character Large Object SQL 类型 CLOB 在 JavaTM 编程语言中的映射关系.SQL CLOB 是内置类型,它将字 ...
- Retrofit 使用简介
一,简介 Retrofit 是目前使用广泛的 Http Client 框架,它适用于 Android 和 Java. 但需要注意的是,Retrofit 本身并不是一个网络请求框架,而是一个网络请求框架 ...
- 2018-2019-2 20165205 网络对抗技术 Exp9 Web安全基础
2018-2019-2 20165205 网络对抗技术 Exp9 Web安全基础 1.基础问题 SQL注入攻击原理,如何防御 原理: SQL注入指攻击者在提交查询请求时将SQL语句插入到请求内容中,同 ...
- python:将numpy数组写入csv文件
import numpy as np np.savetxt('E:\\forpython\\featvector.csv',data_to_save,delimiter=',')
- pandas.DataFrame 中的insert(), pop()
pandas.DataFrame 中的insert(), pop() 在pandas中,del.drop和pop方法都可以用来删除数据,insert可以在指定位置插入数据. 可以看看以下示例. imp ...
- [VBA]提取指定字符串后的数字--代码来源Excelhome
问题:提取check之后的数字 来源:Excelhome Sub 提取数字() Dim regexp As New regexp With regexp .Pattern = "check\ ...