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. 使用HttpClient访问WebHook

    代码: import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.c ...

  2. 小D课堂 - 零基础入门SpringBoot2.X到实战_第2节 SpringBoot接口Http协议开发实战_6、SpringBoot2.xHTTP请求配置讲解

    1.SpringBoot2.xHTTP请求配置讲解 简介:SpringBoot2.xHTTP请求注解讲解和简化注解配置技巧 1.@RestController and @RequestMapping是 ...

  3. 关于TCP粘包和拆包的终极解答

    关于TCP粘包和拆包的终极解答 程序员行业有一些奇怪的错误的观点(误解),这些误解非常之流行,而且持有这些错误观点的人经常言之凿凿,打死也不相信自己有错,实在让人啼笑皆非.究其原因,还是因为这些错误观 ...

  4. OMPL RRTConnet 生成路径和可视化

    默认规划路径算法和RRTConnet路径规划算法生成路径 1.  源代码 #include <ompl/base/SpaceInformation.h> #include <ompl ...

  5. linux后台启动springboot并指定日志文件名称

    如果用nohup启动jar包的话,默认的日志文件就是nohup.out,那么如果启动多个jar包的话,看日志文件就麻烦了,因为他们都会写入到nohup.out文件中. 所以我们来指定一下不同jar包的 ...

  6. Linux的桌面虚拟化技术KVM(四)——虚拟机镜像格式对比与转换

    Linux的桌面虚拟化技术KVM(一)——新建KVM虚拟机 Linux的桌面虚拟化技术KVM(二)——远程桌面管理 Linux的桌面虚拟化技术KVM(三)——KVM虚拟机克隆和快照 (1).常用镜像格 ...

  7. Delphi 调用控件的过程,初学者都想知道

    假设有过程: procedure TForm1.Button1Click(Sender: TObject);begin    ShowMessage('唐细刚 2008');end; 想在 FormC ...

  8. Yii2打印原始sql语句

    $query = User::find() ->where(['id'=>[1,2,3,4]) ->select(['username']) // get the AR raw sq ...

  9. 使用Spring Boot接受HTTP GET/POST请求的一个SQL并返回结果

    这里说的意思是:我向我的Web服务器发送一个请求(因为GET请求的一些限制,所以最好使用POST请求,不过这里作为测试还是使用GET请求),请求中带一个sql参数,它对应查询的数据.然后我的Sprin ...

  10. LODOP带空格和不带空格的字体对齐

    有时候需要用到字体上下对齐,有些需要的文字较多,较少的文字需要加部分空格才能向上面的文字对齐.本文实际测试了一下字体对齐需要的空格.代码是在editplus里写的,该编辑软件里的字体首选项设置的是Co ...