Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 1141, in _when_complete
callback()
File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 1162, in _execute_method
self._when_complete(method(*self.path_args, **self.path_kwargs),
File "/alidata/www/bamboo/decorators/authenticated.py", line 46, in wrapper
return method(self, *args, **kwargs)
File "/alidata/www/bamboo/handlers/products/admin/product.py", line 315, in post
self.redirect("/admin/product/save?step=2&oid=" + str(product.id))
File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 501, in redirect
raise Exception("Cannot redirect after headers have been written")
Exception: Cannot redirect after headers have been written
报错信息:
系统异常'ascii' codec can't encode characters in position 51-66: ordinal not in range(128)
很明显是编码问题,2.x里面编码是大问题,还是换3吧
加上以下代码就好了
import sys
reload(sys)
sys.setdefaultencoding("UTF-8")
换 Python 3.5~
报错的那行是不是有print
语句,去掉试一试,或者编解码试一试。