flask-wtf:TypeError:b'ab37f9dc28822383e290c6fc1188c39f2ab7ff97'不是JSON可序列化的

时间:2017-09-04 11:52:16

标签: python linux typeerror redhat flask-wtforms

我正在尝试使用Apache和CGI 在 Linux RedHat机器(Python 3.4)上运行我的烧瓶应用程序。

但是我收到此错误:

 Traceback (most recent call last):
   File "/usr/lib64/python3.4/site-packages/flask/app.py", line 1982, in wsgi_app
     response = self.full_dispatch_request()
   File "/usr/lib64/python3.4/site-packages/flask/app.py", line 1614, in full_dispatch_request
     rv = self.handle_user_exception(e)
   File "/usr/lib64/python3.4/site-packages/flask/app.py", line 1517, in handle_user_exception
     reraise(exc_type, exc_value, tb)
   File "/usr/lib64/python3.4/site-packages/flask/_compat.py", line 33, in reraise
     raise value
   File "/usr/lib64/python3.4/site-packages/flask/app.py", line 1612, in full_dispatch_request
     rv = self.dispatch_request()
   File "/usr/lib64/python3.4/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
   File "/usr/lib64/python3.4/site-packages/flask_login/utils.py", line 228, in decorated_view
     return func(*args, **kwargs)
   File "/var/www/html/efa-mobile2/mct/app/views.py", line 55, in content_home
     filter_form = Filter_Form()
   File "/usr/lib/python3.4/site-packages/wtforms/form.py", line 212, in __call__
     return type.__call__(cls, *args, **kwargs)
   File "/usr/lib64/python3.4/site-packages/flask_wtf/form.py", line 88, in __init__
     super(FlaskForm, self).__init__(formdata=formdata, **kwargs)
   File "/usr/lib/python3.4/site-packages/wtforms/form.py", line 278, in __init__
     self.process(formdata, obj, data=data, **kwargs)
   File "/usr/lib/python3.4/site-packages/wtforms/form.py", line 132, in process
     field.process(formdata)
   File "/usr/lib/python3.4/site-packages/wtforms/csrf/core.py", line 43, in process
     self.current_token = self.csrf_impl.generate_csrf_token(self)
   File "/usr/lib64/python3.4/site-packages/flask_wtf/csrf.py", line 134, in generate_csrf_token
     token_key=self.meta.csrf_field_name
   File "/usr/lib64/python3.4/site-packages/flask_wtf/csrf.py", line 47, in generate_csrf
     setattr(g, field_name, s.dumps(session[field_name]))
   File "/usr/lib/python3.4/site-packages/itsdangerous.py", line 565, in dumps
     payload = want_bytes(self.dump_payload(obj))
   File "/usr/lib/python3.4/site-packages/itsdangerous.py", line 847, in dump_payload
     json = super(URLSafeSerializerMixin, self).dump_payload(obj)
   File "/usr/lib/python3.4/site-packages/itsdangerous.py", line 550, in dump_payload
     return want_bytes(self.serializer.dumps(obj))
     return json.dumps(obj, separators=(',', ':'))
   File "/usr/lib64/python3.4/json/__init__.py", line 237, in dumps
     **kw).encode(obj)
   File "/usr/lib64/python3.4/json/encoder.py", line 192, in encode
     chunks = self.iterencode(o, _one_shot=True)
   File "/usr/lib64/python3.4/json/encoder.py", line 250, in iterencode
     return _iterencode(o, 0)
   File "/usr/lib64/python3.4/json/encoder.py", line 173, in default
     raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'ab37f9dc28822383e290c6fc1188c39f2ab7ff97' is not JSON serializable

我使用相同的设置等在另一台Linux服务器(Debian 8)上安装了烧瓶应用程序,完美地运行

任何人都可以帮助我吗?

0 个答案:

没有答案