Django runserver UnicodeDecodeError
编码问题可以说是我遇到过的python 2.7最大的败笔
今天写django时,很简单的一个项目却报UnicodeDecodeError,而我的代码中一个中文字符都没有出现。
如下:

网上找到的所谓解决方案,要么不是这个错误,要么也是没有解决。
我自己暂时找到的解决方案。找到上图中的restart_with_reloader函数,作如下修改

简单看了一下,错误应该是程序读取系统环境变量时的编码问题,系统为GBK(显示的cp936即为GBK),而转为utf-8时出错。
改完后程序正常运行,暂时不知道以后会不会出错。
为了便于调试 你可以修改manage.py,以使其可以使用pycharm来调试而不是用简陋的cmd来运行

Django runserver UnicodeDecodeError的更多相关文章
- Django runserver 默认多线程 监听文件变动
django-admin and manage.py | Django documentation | Django https://docs.djangoproject.com/en/3.0/ref ...
- Django runserver支持https
创建自签名ssl证书 1.下载软件openssl-0.9.8k_WIN32 2.解压后进入bin目录,双击打开openssl.exe,依次运行如下命令 genrsa -des3 -out server ...
- Django runserver show client ip
get path of basehttp.py $ python >>> import site >>> site.getsitepackages() ['/usr ...
- Setting up Django and your web server with uWSGI and nginx
https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your we ...
- Django中如何使用django-celery完成异步任务1(转)
原文链接: http://www.weiguda.com/blog/73/ 本篇博文主要介绍在开发环境中的celery使用,请勿用于部署服务器. 许多Django应用需要执行异步任务, 以便不耽误ht ...
- [r]Setting up Django and your web server with uWSGI and nginx
Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...
- Django with uWSGI and nginx
Reference:http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Setting up Dja ...
- Django源码分析之程序执行入口分析
一般我们开启一个django项目,最简单的方法是进入project 目录,这时目录结构是这样的 然后我们执行python manage.py runserver,程序就开始执行了. 那django是如 ...
- 使用uWSGI和nginx来设置Django和你的web服务器
本教程针对那些想要设置一个生产web服务器的Django用户.它介绍了设置Django以使得其与uWSGI和nginx工作良好的必要步骤.它涵盖了所有三个组成部分,提供了一个web应用和服务器软件的完 ...
随机推荐
- laravel中empty(),is_null() 以及isEmpty()
PHP中 empty() empty() 函数用于检查一个变量是否为空. if(empty($result->order)){ //操作 } is_null() is_null() 函数用于检测 ...
- 6、Spring-Kafka4
4.1. Using Spring for Apache Kafka This section offers detailed explanations of the various concerns ...
- C#调用endtask
原文最早发表于百度空间2009-03-23 写这个小工具主要是因为自动化测试那边反馈了一个问题和endtask有关,结果写完之后发现这个问题从程序外部测试不了……c#调endtask主要也是用DllI ...
- Python 互斥锁
互斥锁Mutex的使用 多个线程处理共享数据,数据会出现问题: 2.7之前每100指令切换一次GIL锁,线程就会sleep,线程会把前100条处理指令存放在CPU缓存内,切换GIL锁后放入另外一个线程 ...
- centos6.5换yum源
centos换yum源要借助wget,要先安装wget 输入yum -y install wget命令以安装wget 若安装wget失败或卡死, ctrl+z,ps -ef | grep yum,之后 ...
- 阿里技术专家详解Dubbo实践,演进及未来规划
https://mp.weixin.qq.com/s/9rVGHYfeE8yM2qkSVd2yEQ
- [大数据从入门到放弃系列教程]第一个spark分析程序
[大数据从入门到放弃系列教程]第一个spark分析程序 原文链接:http://www.cnblogs.com/blog5277/p/8580007.html 原文作者:博客园--曲高终和寡 **** ...
- [easyUI] datagrid 数据格 可以进行分页
1. 新建一个GridNode的类: public class GridNode { private Long id; private String title;//投票标题 private Inte ...
- Cookiecutter 使用
1.需求 ①make ②gcc 4.7以上 ③python2.7 应用于Linux/Unix 或者OS X 系统 2.安装 ①减压缩 ②git clone http://github.com/ad30 ...
- English trip EM2-LP-4B At school Teacher:Will
课上内容(Lesson) 词汇(Key Word ) art 美术:艺术 business 商科 engineering 工程学 graphic design 平面造型学 history 历 ...