Django使用 Mysql数据库查询时乱码解决
使用DJANGO+MYSQL开发时,开启django admin, auth, 然后在后台界面添加中文,数据库保存成功,但是在查询时会报错:
TemplateSyntaxError at /admin/auth/group/Caught DjangoUnicodeDecodeError while rendering: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128). You passed in <Group: [Bad Unicode data]> (<class 'django.contrib.auth.models.Group'>)Request Method: GETRequest URL: http://127.0.0.1:8000/admin/auth/group/Django Version: 1.3Exception Type: TemplateSyntaxErrorException Value: Caught DjangoUnicodeDecodeError while rendering: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128). You passed in <Group: [Bad Unicode data]> (<class 'django.contrib.auth.models.Group'>)Exception Location: D:\opt\Python27\lib\site-packages\django\utils\encoding.py in force_unicode, line 93Python Executable: D:\opt\Python27\python.exePython Version: 2.7.2..................