Django 2.x版本迁移数据库报这个错误,user表使用的Django的验证系统

本来就想改一下用户表的表名,莫名的报了个这个错误,在网上找到了解决办法

打开user应用模块下的apps.py文件,这是没修改前的

  1. from django.apps import AppConfig
  2.  
  3. class UserConfig(AppConfig):
  4. name = 'apps.user'

然后修改name值,去掉前边的apps.如下

  1. from django.apps import AppConfig
  2.  
  3. class UserConfig(AppConfig):
  4. 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值,也不能改

  1. from django.apps import AppConfig
  2.  
  3. class GoodsConfig(AppConfig):
  4. 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. maven项目启动找不到org.springframework.web.context.ContextLoaderListener

    解决方法: 1. 右键单击工程项目 ->点击 properties2. 选择 Deployment Assembly3. 点击 Add -> Java Build Path Entries ...

  2. 关于在mac上使用valet集成环境添加memcache扩展

    由于业务要求需要使用到memcache,直接使用brew安装在phpinfo上面显示并没有加载成功,使用以下方法时我们需要先卸载之前已经安装完成的memcache brew unlink php70- ...

  3. mysql gis基本使用

    # 插入空间数据 INSERT INTO `t_pot` VALUES ('1', '北京', POINT(116.401394,39.916042)); INSERT INTO `t_pot` VA ...

  4. CentOS7 安装MySQL8修改密码

    1. 添加MySQL8的本地源 执行以下命令获取安装MySQL源 [root@virde ~]# wget https://repo.mysql.com//mysql80-community-rele ...

  5. flask第二篇 三剑客+特殊返回值

    1.Flask中的HTTPResponse 在Flask 中的HttpResponse 在我们看来其实就是直接返回字符串 2.Flask中的Redirect 每当访问"/redi" ...

  6. oracle中监听程序当前无法识别连接描述符中请求服务 的解决方法

    早上同事用PL/SQL连接虚拟机中的Oracle数据库,发现又报了“ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务”错误,帮其解决后,发现很多人遇到过这样的问题,因此写着这里. ...

  7. 【2】PRD文档介绍

    首先,我想说,题主是一个不严肃的人(严肃脸),所以每次干个啥事之前我都喜欢唠唠嗑,说说废话,沟通沟通感情,曾经以为自己将会成为一个幻想中的产品经理那般大展身手,作为非计算机专业出身的应届生,后来才发现 ...

  8. CoordinatorLayout使用全解析

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u012124438/article/details/56701641 CoordinatorLayo ...

  9. LC 789. Escape The Ghosts

    You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is(tar ...

  10. LC 759. Employee Free Time 【lock, hard】

    We are given a list schedule of employees, which represents the working time for each employee. Each ...