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 ...
随机推荐
- codeforces555B
Case of Fugitive CodeForces - 555B Andrewid the Android is a galaxy-famous detective. He is now chas ...
- permutation 2(递推 + 思维)
permutation 2 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) ...
- SCOI2009迷路
当初学矩阵幂的时候弃掉了,那时候只会用矩阵优化递推,碰到这种图论的瞬间躺地. 昨天听学长的课,有一道例题,在边权为一的图上求从某点到某点的路径方案数,只要对邻接矩阵跑qpow就完事了. 于是自己画了个 ...
- Linux :vim 模式下的常用命令
[参考文章]:vim 复制一整行 复制多行 1. 查找命令 ?text 查找text,按n健查找下一个,按N健查找前一个 /text 反向查找text,按n健查找下一个,按N健查找前一个 ...
- 显示Pl/Sql Developer window list窗口
默认情况下Window List窗口是不显示的,这十分不方便 (一)在菜单项的Tools下的Preference选项中的UserInterface中选择Option,在右边对于的Autosave de ...
- WOE1-Feature Selection 相关:一个计算WOE和Information Value的python工具
python信用评分卡建模(附代码,博主录制) https://study.163.com/course/introduction.htm?courseId=1005214003&utm_ca ...
- [go]从os.Stdin探究文件类源码
咋一看go的标准输入输出函数有一箩筐. 细究了一下. - 从标准输入获取输入 fmt.Scan 以空白(空格或换行)分割,值满后无结束 fmt.Scanln 以空格作为分割,遇到换行结束 fmt.Sc ...
- mysql解决删除数据后,主键不连续问题
题记:强迫症需求,一个小技巧. 亲测有效 SET @i=; UPDATE table_name SET `); ALTER TABLE table_name AUTO_INCREMENT=; 注意:主 ...
- flutter 切换tab后保留tab状态
前言 最近在用flutter写一个小项目,在写主页面(底部导航栏+子页面)时遇到的一个问题:当点击底部item切换到另一页面, 再返回此页面时会重走它的initState方法(我们一般在initSta ...
- SQL学习(八)日期处理
不同数据库中,针对日期处理的函数不同 Oracle中常用日期函数 (1.sysdate: 获取当前系统时间 如: select sysdate() ----返回当前时间,包括年月日 时分秒 (2.to ...