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. 2019牛客暑期多校训练营(第二场)J

    题意 给一个长度为1e9的只包含1和-1的数列,1的个数不超过1e7,计算有多少对\((l,r)\)满足\(\sum_{i=l}^r a[i]>0\) 分析 dp求出每段连续的1最右端为右端点的 ...

  2. Java线程之如何分析死锁及避免死锁

    什么是死锁 java中的死锁是一种编程情况,其中两个或多个线程被永久阻塞,Java死锁情况出现至少两个线程和两个或更多资源. 在这里,我们将写了一个简单的程序,它将导致java死锁场景,然后我们将分析 ...

  3. font属性

    font属性 font属性设置css字体

  4. [CSP-S模拟测试]:B(DP+数学)

    题目传送门(内部题45) 输入格式 第一行$3$个整数$n,m,P$.第二行$m$个整数,表示$m$次询问. 输出格式 一行$m$个整数表示答案. 样例 样例输入1: 2 4 40 1 2 3 样例输 ...

  5. TCP发送窗口更新tcp_ack_update_window

    在tcp_ack接收ACK处理函数中,如果确认当前走慢速路径,那么会调用tcp_ack_update_window函数检查窗口是否需要更新并更新之,并且更新未确认数据的位置,即更新窗口左边沿: sta ...

  6. SpringBoot2.X 静态文件配置

    Spring Boot 默认会挨个从 META/resources > resources > static > public 里面找是否存在相应的资源,如果有则直接返回. 默认配置 ...

  7. Nginx开启访问日志记录

    1. vi /etc/nginx/nginx.conf 2.打开 log_format 前的注释 3.Server节点中加入 access_log logs/www_access.log main; ...

  8. mysql timestamp为0值时,python读取后的对象为None

    MySQL数据表中,如果timestamp类型的字段,值为0, python从数据库读取数据后,得到对象是什么类型,是否为None呢? 下面来测试下. 创建数据表 首先创建数据表,其中字段pr_rul ...

  9. Vue -3:单文件组件

    在很多 Vue 项目中,我们使用 Vue.component 来定义全局组件,紧接着用 new Vue({ el: '#container '}) 在每个页面内指定一个容器元素. 这种方式在很多中小规 ...

  10. Springboot获取resource的路径

    1.获取resource目录下的template路径 String path = Thread.currentThread().getContextClassLoader().getResource( ...