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 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.的更多相关文章
- 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 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文件 ...
- 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 ...
- 在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 ...
- 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 ...
随机推荐
- pip错误 ImportError: No module named 'pip_internal'
ubuntu16.04 - wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate sudo python get-pip.p ...
- 我的一个PLSQL存储过程【我】 改版,加入日志表
创建日志表sql: -- Create table create table PROCEDURE_LOG ( ID ) not null, NAME ), CODE NUMBER, MSG ), IN ...
- Java统计文件数量
Java统计文件数量 package com.vfsd; import java.io.File; import java.io.IOException; /********************* ...
- Dart中的数据类型转换:
int -> string age.toString() string -> int int.parse('100'); String -> double 1 var onePoin ...
- netty5自定义私有协议实例
一般业务需求都会自行定义私有协议来满足自己的业务场景,私有协议也可以解决粘包和拆包问题,比如客户端发送数据时携带数据包长度,服务端接收数据后解析消息体,获取数据包长度值,据此继续获取数据包内容.我们来 ...
- 全面系统Python3入门+进阶-1-6 python能做些什么?
结束
- aar api 导出
import fsys; import math; var pidMap = {}; math.randomize(); fsys.enum( "~\lib", "*.* ...
- python 中删除文件中的空白行(回车)
staff.txt 内容: Alex Li,Engineer,1363432345,alex@126.com Jack Zhang,Salesman,Sales Dep,15697892356,jac ...
- k8s调度器之亲和性和反亲和性/节点选择器
容器在节点(物理机)上是如何部署的 是由调度器scheduler进行调度的 调度策略 随机 通过节点选择器选择某些节点 通过节点亲和性和pod的亲和性及反亲和性实现更细粒度的控制 参考 https:/ ...
- mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息
在对mysql进行完整备份时使用--all-database参数 # mysqldump -u root -h localhost -p --all-database > /root/all.s ...