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

  • 相关阅读:
    VB获取对象成员
    VB一键扫雷
    VBS代码
    C# LINQ GroupBy
    C# 元组和值元组
    数据结构笔记
    DoTween使用
    Unity中常用的数据结构总结
    Unity 坐标系转换
    .Net中C# Dictionary 用法
  • 原文地址:https://www.cnblogs.com/asworm/p/5115717.html
Copyright © 2011-2022 走看看