编码问题可以说是我遇到过的python 2.7最大的败笔

今天写django时,很简单的一个项目却报UnicodeDecodeError,而我的代码中一个中文字符都没有出现。

如下:

网上找到的所谓解决方案,要么不是这个错误,要么也是没有解决。

我自己暂时找到的解决方案。找到上图中的restart_with_reloader函数,作如下修改

简单看了一下,错误应该是程序读取系统环境变量时的编码问题,系统为GBK(显示的cp936即为GBK),而转为utf-8时出错。

改完后程序正常运行,暂时不知道以后会不会出错。

为了便于调试 你可以修改manage.py,以使其可以使用pycharm来调试而不是用简陋的cmd来运行

Django runserver UnicodeDecodeError的更多相关文章

  1. Django runserver 默认多线程 监听文件变动

    django-admin and manage.py | Django documentation | Django https://docs.djangoproject.com/en/3.0/ref ...

  2. Django runserver支持https

    创建自签名ssl证书 1.下载软件openssl-0.9.8k_WIN32 2.解压后进入bin目录,双击打开openssl.exe,依次运行如下命令 genrsa -des3 -out server ...

  3. Django runserver show client ip

    get path of basehttp.py $ python >>> import site >>> site.getsitepackages() ['/usr ...

  4. 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 ...

  5. Django中如何使用django-celery完成异步任务1(转)

    原文链接: http://www.weiguda.com/blog/73/ 本篇博文主要介绍在开发环境中的celery使用,请勿用于部署服务器. 许多Django应用需要执行异步任务, 以便不耽误ht ...

  6. [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 ...

  7. Django with uWSGI and nginx

    Reference:http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Setting up Dja ...

  8. Django源码分析之程序执行入口分析

    一般我们开启一个django项目,最简单的方法是进入project 目录,这时目录结构是这样的 然后我们执行python manage.py runserver,程序就开始执行了. 那django是如 ...

  9. 使用uWSGI和nginx来设置Django和你的web服务器

    本教程针对那些想要设置一个生产web服务器的Django用户.它介绍了设置Django以使得其与uWSGI和nginx工作良好的必要步骤.它涵盖了所有三个组成部分,提供了一个web应用和服务器软件的完 ...

随机推荐

  1. linux命令之pssh命令

    查看一下pssh命令的帮助文档: [root@test2 ~]# pssh --version [root@test2 ~]# pssh --help Usage: pssh [OPTIONS] co ...

  2. Linux sar工具安装使用

    使用sar Sar是后台进程sadc的前端显示工具,安装名为“sysstat”的包后,sadc就会自动从内核收集报告并保存.   安装sar [root@localhost ~]# yum insta ...

  3. 关于vim的折叠

    参考: http://www.cnblogs.com/fakis/archive/2011/04/14/2016213.html 和 这篇文章: https://blog.csdn.net/benda ...

  4. 牛客练习赛43C Tachibana Kanade Loves Review

    题目地址 Link 题解 虚点这种东西还是没有掌握好啊. 考虑建一个虚点,向已经学会的东西连一条边权为0的边,关系正常连边,单独学的从虚点连一条边过去. 然后做一遍最小生成树就得到答案了. 这题略卡常 ...

  5. Docker应用

    1.tomcat容器创建 docker run -d --name Jdd_tomcat  -p 8081:8080 tomcat [root@localhost etc]# docker run - ...

  6. Windows 用bat脚本带配置启动redis,并用vb脚本使其在后台运行。

    最近,在Windows上用开发PHP程序,需要用到Redis,每天要打开一个运行redis-server.exe的窗口这样比较烦,因为窗口就一直打开着,不能关闭. 所以就想着通过写脚本的方式,让他在后 ...

  7. 使用Docker方式创建3节点的Etcd集群

    一.简要说明 二.运行容器 三.验证集群 四.运行截图 五.参考链接 一.简要说明     参考etcd官网文档, 在node1.node2.node3三个节点上,分别运行etcd容器,创建etcd集 ...

  8. Asp.net core 学习笔记 ( Data protection )

    参考 : http://www.cnblogs.com/xishuai/p/aspnet-5-identity-part-one.html http://cnblogs.com/xishuai/p/a ...

  9. port 执行命令的封装和参数详解

    下面代码摘自rebar_utils.erl -module(tt7). %-export([start/0]). -compile(export_all). -define(FAIL, abort() ...

  10. Swapping Characters CodeForces - 903E (字符串模拟)

    大意: 给定k个字符串, 长度均为n, 求是否存在一个串S, 使得k个字符串都可以由S恰好交换两个字符得到. 暴力枚举交换的两个字符的位置, 计算出交换后与其他串不同字符的个数, 若为1或>2显 ...