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 ...
随机推荐
- github无法访问解决方法
windows 系统下找到目录 C:\Windows\System32\drivers\etc 打开 hosts 文件 添加以下配置 #github140.82.114.3 github.com 保存 ...
- [BUUOJ]刮开有奖reverse
刮开有奖 这是一个赌博程序,快去赚钱吧!!!!!!!!!!!!!!!!!!!!!!!!!!!(在编辑框中的输入值,即为flag,提交即可) 注意:得到的 flag 请包上 flag{} 提交 1.查壳 ...
- c#——ToString()的各种用法
ToString()的各种用法 string str = ""; str = 123456.ToString("N"); //生成 12,3456.00 str ...
- junit 测试用例多并发
最近再用测试用例写个多并发,但是测试用例一运行完程序就结束啦.还没有等到多线程运行完.这个时候可以用断点在多线程后面停住或者让主线程睡眠多一些
- 常见数据库的JDBC URL
转自:http://blog.csdn.net/ring0hx/article/details/6152528 Microsoft SQL Server Microsoft SQL Server JD ...
- 人脸识别--SeetaFace
检测:http://download.csdn.net/detail/qq_14845119/9639840 对齐:http://download.csdn.net/detail/qq_1484511 ...
- Buffer的重要属性 position/limit/capacity
1 package nio; 2 3 import java.nio.IntBuffer; 4 5 /** 6 * Buffer的重要属性 position/limit/capacity 7 * po ...
- android stdio 打包
1.Build -> Generate Signed APK...,打开如下窗口 2.假设这里没有打过apk包,点击Create new,窗口如下 这里只要输入几个必要项 Key store p ...
- LeetCode 面试题16.18.模式匹配
模式匹配 题目: 你有两个字符串,即pattern和value. pattern字符串由字母"a"和"b"组成,用于描述字符串中的模式.例如,字符串" ...
- CentOS 7 网卡注释
TYPE=Ethernet # 网络类型为:EthernetPROXY_METHOD=none # 代理方式:关闭状态BROWSER_ONLY=no # 只是浏览器:否BOOTPROTO=static ...

