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.的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. RuntimeError: Model class myapp.models.Test doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

    没有添加子应用在settings里面!

  5. 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 ...

  6. 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, " ...

  7. 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 & ...

  8. 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 ...

  9. 在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 ...

随机推荐

  1. python3笔记十七:python文件读写

    一:学习内容 读文件 写文件 编码与解码 二:读文件--步骤分解 1.过程 第一步:打开文件第二步:读文件内容第三步:关闭文件 2.第一步:打开文件 open(path,flag[,encoding] ...

  2. H264之基础篇

    1. H264 基础概念 在 H.264/AVC 视频编码标准中,整个系统框架划分为如下两个层面: 视频编码层(VCL):VCL 数据即被压缩编码后的视频数据序列,负责有效表示视频数据的内容: 网络抽 ...

  3. 统计网络time_wait连接状态及tcpip连接数

    netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' LAST_ACK 1 SYN_RECV 14 ESTABLIS ...

  4. windows实用cmd命令总结

    D: 进入D盘 cd D:\eclipse   进入D盘后进入D盘下的某个路径 Ipconfig 查看计算机ip Cls 清空命令行 ping ip(主机名) 测试网络是否畅通 Help 查看所有的d ...

  5. LC 384. Shuffle an Array

    Shuffle a set of numbers without duplicates. Example: // Init an array with set 1, 2, and 3. int[] n ...

  6. 修改Android EditText光标颜色和底线颜色

    1.修改光标颜色 EditText有一个属性:android:textCursorDrawable,这个属性是用来控制光标颜色的android:textCursorDrawable="@nu ...

  7. 阶段3 3.SpringMVC·_06.异常处理及拦截器_4 SpringMVC拦截器之介绍和搭建环境

    拦截器可以有多个 搭建环境 不用改,直接finish 复制原来项目的 依赖的包也复制过来 web.xml配置前端控制器 springmvc的配置文件 先创建对应的文件夹 分别创建java和resour ...

  8. 五十六:flask文件上传之上传文件与访问上传的文件

    实现上传文件 1.在form表单中,需指定enctype="multipart/form-data",且文件上传的input标签type="file"2.在后台 ...

  9. kvm的使用(2)

    一.远程管理kvm虚机 (2)有些情况下,有一个要配置的地方. 因为 KVM(准确说是 Libvirt)默认不接受远程管理,需要按下面的内容配置被管理宿主机中的两个文件: vim /etc/defau ...

  10. 2019.05.30 S4 BUPT BP 客户增强说明

    - 看了一圈,发现网上BUPT增强的很少,有的也是做一个字段的页签的增强,我自己花时间研究了一下,在BP增加新的interface 界面按钮. BP页签增强部分就不写了,大家看链接吧 加上如何做出新的 ...