这是因为在视图函数中使用了get函数,获取了不存在的数据
例如:数据库中不存在一条name为hello1的数据,使用如下语句访问
message = Message.objects.get(name='hello1')

就会报错 message = Message.objects.get(name='boddy1')

解决方法:
见下图:
windows中使用django时报错:A server error occurred.  Please contact the administrator.

 

 点击上图框中的链接后,自动进入debug.py文件的323行,对321行代码修改见下图:windows中使用django时报错:A server error occurred.  Please contact the administrator.

 

 

windows中使用django时报错:A server error occurred.  Please contact the administrator.

 

 再次运行:

windows中使用django时报错:A server error occurred.  Please contact the administrator.

 

 

此时报错信息正常,查询的数据不存在

在MAC 和 Linux中不存在这种问题,在 MAC 和 Linux中已经将编码方式默认为 utf8

相关文章:

  • 2021-10-10
  • 2021-10-25
  • 2021-06-21
  • 2021-09-07
  • 2021-08-09
  • 2021-11-19
  • 2021-07-01
  • 2021-11-24
猜你喜欢
  • 2021-07-29
  • 2021-12-31
  • 2021-05-29
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案