我正在从 Django 1.3 升级到 1.5 在 1.3 中发现一切正常,但在 1.5.5 中我遇到了一堆编码错误。查看堆栈:
Traceback:
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
187. response = middleware_method(request, response)
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/contrib/sessions/middleware.py" in process_response
38. request.session.save()
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/contrib/sessions/backends/cached_db.py" in save
55. super(SessionStore, self).save(must_create)
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py" in save
51. session_data=self.encode(self._get_session(no_load=must_create)),
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in encode
84. serialized = self.serializer().dumps(session_dict)
File "/Users/athom09/Projects/myapp/myappEnv/lib/python2.7/site-packages/django/core/signing.py" in dumps
100. return json.dumps(obj, separators=(',', ':')).encode('latin-1')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py" in dumps
238. **kw).encode(obj)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py" in encode
201. chunks = self.iterencode(o, _one_shot=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py" in iterencode
264. return _iterencode(o, 0)
Exception Type: UnicodeDecodeError at /login/
Exception Value: 'utf8' codec can't decode byte 0xaa in position 0: invalid start byte