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

  • 相关阅读:
    pyhanlp 实体命名识别
    NABCD需求分析
    源代码
    遇到的问题和解决方法
    运行及总结
    测试与调试
    读《一个程序猿的生命周期》和《人,绩效和职业道德》有感
    面向对象程序设计
    设计类图
    SRS文档
  • 原文地址:https://www.cnblogs.com/asworm/p/5115717.html
Copyright © 2020-2023  润新知