django运行报错:SystemCheckError: System check identified some issues

django中在迁移数据库时报如下错误:
在这里插入图片描述

这个错误是因为那你使用的自定义的模型,而django中若不配置,就会自动用他自己内置的model
方法:在settings中配置自定义的model:AUTH_USER_MODEL = ‘customuser.UserModel’
在这里插入图片描述

配置完这个参数后,再迁移数据库就不会报这个错了。

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
当你在运行Django项目时,可能会遇到`SystemCheckError`误,它通常表示Django系统检查发现了一些问题。这些问题可能包括模型定义的问题、应用程序配置的问题等等。通常,当你执行以下命令时,Django会自动运行系统检查: ``` python manage.py runserver ``` 如果系统检查发现了问题,它会输出一个或多个误消息,并在最后显示`SystemCheckError`误。例如: ``` SystemCheckError: System check identified some issues: ERRORS: blog.Article.author: (fields.E301) Field defines a relation with model 'auth.User', which is either not installed, or is abstract. blog.Article.author: (fields.E307) The field blog.Article.author was declared with a lazy reference to 'auth.user', but app 'auth' doesn't provide model 'user'. blog.Comment.user: (fields.E301) Field defines a relation with model 'auth.User', which is either not installed, or is abstract. blog.Comment.user: (fields.E307) The field blog.Comment.user was declared with a lazy reference to 'auth.user', but app 'auth' doesn't provide model 'user'. System check identified 4 issues (0 silenced). ``` 在这个例子中,系统检查发现了4个问题,其中3个与auth.User有关,因为`blog.Article`和`blog.Comment`模型都定义了与`auth.User`模型的关系,但是`auth.User`模型似乎不存在。 要解决这个问题,你需要检查你的Django项目中的模型定义和应用程序配置,并确保所有依赖于的模型都存在,并且在应用程序配置中正确注册。一旦你修复了这些问题,再次运行`python manage.py runserver`命令,就应该不再遇到`SystemCheckError`误了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值