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 ...
随机推荐
- delphi将一个list中包含的元素,从另一个中删除,如果在另一个中存在的话
Function StrList_Del(StrList,DelStrList:String):String; //将DelStrList中包含的元素,从Strlist中删除,如果在Strlist中存 ...
- Spring——JdbcTemplate
一.JdbcTemplate介绍: 为了使 JDBC 更加易于使用,Spring 在 JDBCAPI 上定义了一个抽象层, 以此建立一个JDBC存取框架,Spring Boot Spring Data ...
- simple queue(简单队列)
Virtual host-虚拟主机 虚拟主机,用于进行逻辑隔离,是最上层的路由,类似于redis的16个db,是一种逻辑上的隔离 一个virtualhost里面可以有若干个Exchange和Queue ...
- Java内存和垃圾回收
Java内存大体上可以分为:本地方法区(线程共享).Java栈(线程隔离).本地方法栈(线程隔离).Java堆(线程共享).程序计数器(线程隔离). 1.本地方法区 各个线程共享的内存区域,只要存放被 ...
- Windows下Yarn安装与使用
参考博客 1.安装yarn 方法一:使用安装包安装 官方下载安装包,https://yarnpkg.com/zh-Hans/docs/install,安装完毕后,一定要配置环境变量. 方法二:使用np ...
- Android开源界面库--ResideMenu用法
网上关于ResideMenu用法的教程很多,但基本上全是从Github上copy下来的,Gitbub上给出的了对应的demo,但是由于我的IDE原因吧,demo一直导入不成功.为此自己又捣鼓了一翻,终 ...
- linux 分区管理
1. 查看系统中硬盘的设备 [root@centos6 ~]# ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sdb 可以看出,系统有 ...
- 20175215 2018-2019-2 第十周java课程学习总结
第十二章 Java多线程机制 12.1 进程与线程 12.1.1 操作系统与进程 程序是一段静态的代码,它是应用软件执行的蓝本. 进程是程序的一次动态执行过程,它对应了从代码加载.执行至执行完毕的一个 ...
- java拦截器获取请求完整参数
public class OptLogAspect implements HandlerInterceptor { @Override public boolean preHandle(HttpSer ...
- Linux下深度学习常用工具的安装
.Matlab 2015 64bit 的安装 (一)安装包下载 百度网盘: [https://pan.baidu.com/s/1gf9IeCN], 密码: 4gj3 (二)Vmware 使用Windo ...