问题描述
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. 屌丝程序员的梦想 (二) 屌丝IT梦开始地方

    校区的周围有很多的网吧,一个对电子游戏迷恋了许久的青少年来说,那绝对是不可不去的地方,键盘,鼠标,显示器,那一切看起来都那么完美,那么似曾相识,是啊,魂牵梦绕的IT梦...哦..当时那只是电子游戏梦. ...

  2. 怎样设置才能允许外网访问MySQL

    1.将本地数据库的user表的第一条记录的host数据改为%,或者用update user set host='%' where user='root'; 2.用MySQL的命令行客户端操作如下步骤: ...

  3. Android驱动开发前的准备

    最近看了一些Android驱动开发前需要知道的资料,收获很多,接下来就谈谈我自己的一些心得体会. Android在近几年时间发展迅速,已经成为智能手机操作系统的老大.不过,因为Android原生的代码 ...

  4. Find cmd

    Find cmd with python programing python at page320 Unix find cmd: find . -name "*.py " -pri ...

  5. STL—Vector简介

    有关C++ STL 中的vector向量的用法(代码示例) 一. 简介 Vector是一个称为向量的顺序容器(不明白顺序容器与关联容器的可以Google). 二. 特点 1. 动态(相当于一个动态数组 ...

  6. Oracle基本sql操作

    1.查询用户下的所有表 查询用户下的所有表 select distinct table_name from user_tab_columns; 2.搜索出前N条记录 Select a.*,rownum ...

  7. HTML5&CSS3练习笔记(二)

    HTML5&CSS3  练习CSS3伪选择器使用 1.first-line  格式:元素:first-line 说明:设置同一个标签下所有行内容的第一行的样式,例如: <table st ...

  8. Unity 性能

    Unity 5.0 AMD 7650k 自带核显 Unity自建立方体2000正方体 50帧 但每个立方体多达60面 多个三角形 每秒100万面绘制 可能每个都要单独计算光照? 导入3ds模型相当于 ...

  9. java反射小例子

    package com.txwsqk.reflect; public class Car { private String brand; private String color; private i ...

  10. Solution for Error FRM-92095: Oracle Jnitiator version too low

    Solution for Error FRM-92095: Oracle Jnitiator version too low By Pan.Tian on 六月 04, 2013 Symtom: Af ...