我想问一下为什么我往setting.py的INSTALLED_APPS 中添加我的app——'books'后,运行服务器是老是出现编码问题呢(我的mysql设置的是‘gbk’格式的,也有‘books’这个数据库,)?





求大侠解决啊!!小弟不甚感激!!
------解决方案--------------------------------------------------------
import sys
reload(sys)
sys.setdefaultencoding('gbk')
------解决方案--------------------------------------------------------
查询前执行SQL指令: set names utf8