问题描述
UnicodeEncodeError at /admin/polls/question/3/
'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
Request Method: GET
Request URL: http://114.215.84.142:9999/admin/polls/question/3/
Django Version: 1.8
Exception Type: UnicodeEncodeError
Exception Value:
'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
Exception Location: /root/demo1/local/lib/python2.7/site-packages/django/utils/encoding.py in force_text, line 94
Python Executable: /root/demo1/bin/python
Python Version: 2.7.6
Python Path:
['/root/demo1/wsf',
'/root/demo1/lib/python2.7',
'/root/demo1/lib/python2.7/plat-x86_64-linux-gnu',
'/root/demo1/lib/python2.7/lib-tk',
'/root/demo1/lib/python2.7/lib-old',
'/root/demo1/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/root/demo1/local/lib/python2.7/site-packages',
'/root/demo1/lib/python2.7/site-packages']
Server time: Sat, 9 Jan 2016 03:19:57 +0000
Unicode error hint

The string that could not be encoded/decoded was: 你好啊
Error during template rendering

In template /root/demo1/local/lib/python2.7/site-packages/django/contrib/admin/templates/admin/change_form.html, error at line 21
ascii
11 {% block coltype %}colM{% endblock %}
12
13 {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}
14
15 {% if not is_popup %}
16 {% block breadcrumbs %}
17

18 {% trans 'Home' %}
19 › {{ opts.app_config.verbose_name }}
20 › {% if has_change_permission %}{{ opts.verbose_name_plural|capfirst }}{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
21
› {% if add %}{% trans 'Add' %} {{ opts.verbose_name }}{% else %}
{{ original|truncatewords:"18" }}
{% endif %}

22

23 {% endblock %}
24 {% endif %}
25
26 {% block content %}

27 {% block object-tools %}
28 {% if change %}{% if not is_popup %}
29
    30 {% block object-tools-items %}

django例子,question_text为中文时候报错的更多相关文章

  1. Django 编写自定义的 404 / 500 报错界面

    Django 编写自定义的 404 / 500 报错界面 1. 首先 setting.py 文件中的 debug 参数设置成 false ,不启用调试. DEBUG = False 2. 在 temp ...

  2. webstorm中sass编译时目录或内容包含中文字符报错

    ruby版本:ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32] sass版本:Sass 3.4.22 (Selective Steve) ...

  3. python2 + selenium + eclipse 中,通过django生产数据库表的时候报错

    python2 + selenium + eclipse 中,通过django生产数据库表的时候报错 解决: 1.查看自己电脑中,“开始-->控制面板-->管理工具-->服务--&g ...

  4. 记一次 Hibernate 插入数据中文乱码报错解决

    错误描述 程序运行,向表中插入数据(包含中文)报错:\xE6\xB2\x88\xE9\x9B\xAA... 但是自己另外新建一个数据库手动插入数据中文正常,同样修改数据库,表的编码之后同样不行.而且 ...

  5. sass中中文注释报错

    最近项目中用到了sass来编译css,但是scss代码中写了中文注释后编译报错, 经过查找文档和资料,终于找到了解决办法,即在scss文件顶部加上@charset "utf-8"; ...

  6. Control character in cookie value, consider BASE64 encoding your value , java操作cookie遇到中文会报错的解决方案

    项目当中用到cookie保存中文,但是会报如下错误: Control character in cookie value, consider BASE64 encoding your value 大概 ...

  7. Cookie保存中文用户名报错(500)

    在用Cookie保存用户名时候,当用户名是中文的时候服务器报错了. HTTP Status 500 - An exception occurred processing JSP page /dolog ...

  8. 玄学bug(1)---注释里面的中文会报错

    有时候正常没有问题的程序会报错,可能跟注释里面的中文也有关系 with open('photo1.jpg','rb') as file: data = file.read() #print(data) ...

  9. opencv读取中文路径报错的问题

    ) ## 经验证,不需要再转bgr,myImread的读图结果已经是和imread一样的 return img

随机推荐

  1. (一)NOR FALSH 讲解

    nor flash 起始地址: 1F FFFF  = 1 1111          1111 1111 1111 1111 = 2^20 *2 = 2^21=2M Nor Flash 采用了 A0- ...

  2. TCL笔试题 将A,B,B,C,D,E,第三个字符不可以是E的所有组合输出;

    思路:利用排列思想,进行递归:#include "iostream" using namespace std; ]; void pick_one(char a[],int num[ ...

  3. python执行线程方法

    转自: http://www.jb51.net/article/71908.htm 由于python线程没有提供abort方法,所以我们需要自己想办法解决此问题,面对这一问题,小编帮大家解决phtho ...

  4. Python Thread related

    1.Thread.join([timeout]) Wait until the thread terminates. This blocks the calling thread until the ...

  5. nodejs回调函数

    阻塞代码实例: main.js var fs=require("fs"); var data=fs.readFileSync("1.txt"); console ...

  6. jQuery对json快速赋值

    jQuery对json快速赋值,重点在于将input的id取跟JSON同样的名称. <!DOCTYPE html> <html> <head lang="en& ...

  7. 裁剪Tessdata

    一个项目只需要tesseract traineddata 中的数字部分. 实现过程简单说就是解包,去掉多余,再打包.利用了tesseract的dawg2wordlist  /  wordlist2da ...

  8. 利用 Serial Over Lan(SOL)搭建 XEN 的调试信息输出环境

    如有转载,请注明出处与本文连接,谢谢! 修改XEN的源码实现额外的功能,需要有一个调试环境来得到XEN的调试信息(有关源码编译并安装 XEN 请阅读我以前的博文:在CentOS下源码安装 Xen并搭建 ...

  9. [LeeCode]Power of Two

    Given an integer, write a function to determine if it is a power of two. My initial code: class Solu ...

  10. N久没写过东西了..写个最近在研究的程序

    import numpy as np import matplotlib.pyplot as plt #a = np.matrix([[1,1.15],[1,1.9],[1,3.06],[1,4.66 ...