windows中使用django时报错:A server error occurred. Please contact the administrator.
这是因为在视图函数中使用了get函数,获取了不存在的数据
例如:数据库中不存在一条name为hello1的数据,使用如下语句访问
message = Message.objects.get(name='hello1')
就会报错 message = Message.objects.get(name='boddy1')
解决方法:
见下图:
点击上图框中的链接后,自动进入debug.py文件的323行,对321行代码修改见下图:
再次运行:
此时报错信息正常,查询的数据不存在
在MAC 和 Linux中不存在这种问题,在 MAC 和 Linux中已经将编码方式默认为 utf8
windows中使用django时报错:A server error occurred. Please contact the administrator.的更多相关文章
- 添加数据时报错:An error occurred while updating the entries. See the inner exception for detail。
场景:前几天在项目开发时,有个bug经常出现,今天花了一整天,终于把它解决了.记录一下解决流程. 解决方法: 主要报错的地方在添加的部分: 1 foreach (var requestProperty ...
- Linux下安装过程中编译PHP时报错:configure: error: libjpeg.(a|so) not found
在Linux下安装PHP过程中,编译时出现configure: error: libjpeg.(a|so) not found 错误的解决的方法: 检查之后发现已经安装libjpeg.可是/usr/l ...
- MyEclipse for Spring启动时报错"An internal error occurred during: 'Updating indexes'.Java heap space"的解决办法
问题 MyEclipse for Spring在启动时,报如下错误:An internal error occurred during: 'Updating indexes'.Java heap sp ...
- c#保存datagridview中的数据时报错 “动态SQL生成失败。找不到关键信息”
ilovejinglei 原文 C#中保存datagridview中的数据时报错"动态SQL生成失败.找不到关键信息" 问题描述 相关代码 using System; us ...
- 安装Django时报错'module' object has no attribute 'lru_cache'
使用pip方法安装Django时报错'module' object has no attribute 'lru_cache' 解决办法如下 命令行输入命令sudo pip install Django ...
- 301ReidrectPages中重复记录导致的500 server error
在Umbraco平台开发一个系统时,遇到一个问题,报错500 server error, system is currently unable to handle this request. 按下F1 ...
- Linux下安装mysql时报错:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper
如题,安装mysql过程中,执行scripts/mysql_install_db --user=mysql命令时报错: FATAL ERROR: please install the followin ...
- Eclipse启动报错An internal error occurred during: "Initializing Java Tooling"
Eclipse启动报错An internal error occurred during: "Initializing Java Tooling" 解决方案: 删除工作空间work ...
- 解决使用DBeaver连接MySQL时报错-The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.
解决使用DBeaver连接MySQL时报错,其实提示很明显. The server time zone value '�й���ʱ��' is unrecognized or represents ...
随机推荐
- Python 中的运算符重载
本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理 一种运算符对于不同类型的对象,有不同的使用方式.例如, + 用于整型对象,表示两个数相加:用于字符串 ...
- C# Attribute特性 泛型<T> 方法的out ref this(扩展方法) Equals与==
out ref out和ref的使用场景其实不一样.out适合在方法内返回一个额外的结果参数,而ref适合直接改变一个在方法外面的值,方法改变外部就改变,无需重新定义接住返回值再使用. out可以在方 ...
- 微软自带打包工具 InstallShield 的使用
1.下载并安装 InstallShield InstallShield Limited Edition for Visual Studio 2013 图文教程(教你如何打包.NET程序) Ins ...
- [Python] iupdatable包:Status 模块使用介绍
常用状态做的一个集合,方便用在函数返回值中区分不同状态结果. 简单举例: from iupdatable import Status def fun(): print("do somethi ...
- vue结合element-ui table本地分页
<template> <el-table :data="tableData1.slice((start1-1)*length1,start1*length1)" ...
- java中邮件通知
// 客户信息 Tkhxx tkhxx = new Tkhxx(); try { String msg = tkhxx.toString(); MailUtil.simpleMailSend(Mail ...
- [leetcode]82. Remove Duplicates from Sorted List
第一题:遍历链表,遇到重复节点就连接到下一个. public ListNode deleteDuplicates(ListNode head) { if (head==null||head.next= ...
- 微信小程序-页面下拉
微信小程序当滑动到最顶部和最底部时,继续下拉,会将整个页面拉下去或者拉上去,本来以为是客户端自有的特性,就没去管他,直到我的禅道出现了这个记录... 其实这个问题是可以解决的,只需要在你不想出现在此情 ...
- C语言丨博客作业03
这个作业属于哪个课程 https://edu.cnblogs.com/campus/zswxy/SE2020-3/ 这个作业要求在哪里 https://edu.cnblogs.com/campus/z ...
- 8种常被忽视的SQL错误用法,你中招了吗?
前言 MySQL在近几年仍然保持强劲的数据库流行度增长趋势.越来越多的客户将自己的应用建立在 MySQL 数据库之上,甚至是从 Oracle 迁移到 MySQL上来.但也存在部分客户在使用 MySQL ...