zoukankan      html  css  js  c++  java
  • 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 %}

  • 相关阅读:
    tomcat配置数据源
    Spring 配置详解
    典型的软件开发模型
    600字让你读懂Git
    JVM的自愈能力
    Maven的pom.xml文件详解
    如何使用Log4j
    掌握jQuery插件开发,这篇文章就够了
    CSS Gradient详解
    CSS Transition
  • 原文地址:https://www.cnblogs.com/asworm/p/5115717.html
Copyright © 2011-2022 走看看