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 ...
随机推荐
- sh_13_字典的应用场景
sh_13_字典的应用场景 # 使用 多个键值对,存储 描述一个 物体 的相关信息 —— 描述更复杂的数据信息 # 将 多个字典 放在 一个列表 中,再进行遍历 card_list = [ {&quo ...
- bootstrap单选框复选框的使用
<form role="form"> <div class="form-group"> <label class="ch ...
- [CSP-S模拟测试]:最大或(数学)
题目传送门(内部题141) 输入格式 输入文件包含多组测试数据,第一行为一个正整数$T$,表示数据组数. 接下来$T$行,每行两个正整数$l,r$.数据保证$l\leqslant r$成立. 输出格式 ...
- C++入门经典-例7.2-利用构造函数初始化成员变量
1:在创建对象时,程序自动调用构造函数.同一个类中可以有多个构造函数,通过这样的形式创建一个CPerson对象,例如: CPerson p1(0,"jack",22,7000); ...
- TCP套接字选项SO_LINGER与TCP_LINGER2
概述 本文对两个LINGER相关的套接字选项进行源码层面的分析,以更明确其各自的作用和区别: man page SO_LINGER,该选项是socket层面的选项,通过struct linger结构来 ...
- python接口自动化:pycharm中import yaml报错问题解决
一:问题 python3在cmd命令行中已经安装了yaml,且import yaml是成功的,但是pcharm中import yaml还是红色报错 二:分析原因 pycharm和python环境需要分 ...
- EBS 修改系统颜色
1)修改 配置文件: Java 色彩设计,选择相应的颜色 2)清理高速缓存 注:如果不清理缓存,则要等15分钟后才显示变成新设定的颜色
- 求平面上N点最远两点和最近两点距离
最近两点,二分法 最远两点,凸包+找对踵点
- LC 655. Print Binary Tree
Print a binary tree in an m*n 2D string array following these rules: The row number m should be equa ...
- 使用Statement对象执行静态sql语句
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java ...