加油努力,

django例子,question_text为中文时候报错

问题描述
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


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 %}

posted @ 2016-01-09 11:22  活着挺好  阅读(2891)  评论(4编辑  收藏  举报

我是郎