Django启动的时候报错

File "/home/hehecat/PycharmProjects/MxShop/MxShop/urls.py", line 23, in

from users.views import UserViewSet

File "/home/hehecat/PycharmProjects/MxShop/apps/users/views.py", line 13, in

from users.models import EmailVerifyCode

File "/home/hehecat/PycharmProjects/MxShop/apps/users/models.py", line 8, in

class UserProfile(AbstractUser):

File "/home/hehecat/anaconda3/envs/restful/lib/python3.6/site-packages/django/db/models/base.py", line 118, in new

"INSTALLED_APPS." % (module, name)

RuntimeError: Model class users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

users的model无法正确引入

根据提示去setting中的INSTALLED_APPS 看看

INSTALLED_APPS = [
...
'users.apps.UsersConfig',
...
]

'users.apps.UsersConfig' 直接修改为‘users’,正确

那就是apps.UsersConfig有问题了

users/apps.py

class UsersConfig(AppConfig):
name = 'app.users'
verbose_name = '用户'

name修改name = 'users'为即可

RuntimeError: Model class users.models.UserProfile 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 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文件 ...

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

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

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

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

随机推荐

  1. Apollo源码打包及部署

    1. 通过源码打包 到携程Apollo地址 https://github.com/ctripcorp/apollo 下载Apollo源码,可在源码中进行自定义配置日志路径及端口等,之后打包. 打包完成 ...

  2. chrome下载提示网络错误

    问题背景:项目开发测试阶段出现该问题. 复现:开发调试过程中一直没有问题,本地下载excel.Word.pdf 都完美,但是在服务部署到服务器之后,测试环境的chrome就总是下载失败,提示网络错误. ...

  3. Java static静态关键字 有啥用

    #static有啥用 在Java语言中,static表示“静态”的意思,使用场景可以用来修饰成员变量和成员方法,当然也可以是静态代码块.static的主要作用在于创建独立于具体对象的域变量或者方法. ...

  4. word: 插入或修改文字时后面的字消失 解决办法

    在编辑Word文档中的文字时,我们有时需要插入或修改文字,可是在插入或修改时会发现改动处后面的文字会消失.比如插入或修改3个字,后面的文字随之也会消失3个,这时该怎么办呢? 点击-“文件”-“选项”- ...

  5. [转]BigDecimal使用(整理)

    原文地址:https://www.jianshu.com/p/2947868d76eb 应用场景 大多数的商业计算中,一般采用java.math.BigDecimal类来进行精确计算.比如:货币 使用 ...

  6. cordova run android 可能遇到的错误解决

    运行: ionic cordova build 等待下载,然后根据提示 输入android或者ios平台,即可 运行cordova run android 报错: 最快捷的解决方法就是使用Androi ...

  7. 008-guava 并发工具ListenableFuture、Service

    一.ListenableFuture工具使用 guava 并发工具:ListenableFuture jdk8 提供了:CompletableFuture 实现,推荐使用 jdk 8 Completa ...

  8. 002-06-RestTemplate-请求示例-form、json、multipart、okhttp3

    一.概述 请求示例集合 服务端:https://github.com/bjlhx15/common-study.git 中的 http-client-webserver 服务端:RequestBody ...

  9. Spring cloud微服务安全实战-5-7实现基于session的SSO(客户端应用的Session有效期)

    授权模式改造成了Authorization code完成了改造的同时也实现了SSO.微服务环境下的前后端分离的单点登陆. 把admin的服务重启.刷新页面 并没有让我去登陆,直接就进入了首页. ord ...

  10. C++的override和final

    1.final用于让虚函数不可被重写 struct B2 { virtual void f() final {} // final 函数 }; struct D2 : B2 { virtual voi ...