Django内置注释模型管理导致utf8

2024-04-20 13:34:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我添加了standart评论模型('django.contrib.comments.评论'与'django.contrib.sites公司'从django教程,它工作得很好。但当我试图在“评论管理”中显示注释列表时,它会导致错误:

UnicodeDecodeError at /admin/comments/comment/
'utf8' codec can't decode byte 0xc2 in position 80: invalid continuation byte
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/comments/comment/
Django Version: 1.6.4
Exception Type: UnicodeDecodeError
Exception Value:    
'utf8' codec can't decode byte 0xc2 in position 80: invalid continuation byte
Exception Location: C:\Python27\lib\encodings\utf_8.py in decode, line 16
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.6

Unicode error hint

The string that could not be encoded/decoded was: ONE '������
Error during template rendering

In template C:\Users\Harkonnen\PycharmProjects\alpha\grappelli\templates\admin\change_list.html, error at line 207
utf8
205         <!-- DATE HIERARCHY -->
206         {% block date_hierarchy %}
207             {% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}
208         {% endblock %}

不编辑standart django或grappeli模型是否可能解决此错误?在

Upd:without grappelli相同的错误=(

^{pr2}$

Tags: djangoin模型dateadminhierarchy错误exception
2条回答

在你的设置.py你有其他的默认字符集配置吗?在

看这个: https://docs.djangoproject.com/en/dev/ref/settings/#default-charset

Django的其他文件中提到:

Django natively supports Unicode data everywhere.

https://docs.djangoproject.com/en/1.7/ref/unicode/

大多数人用pytz表示时区。安装了它,错误消失了。在

相关问题 更多 >