Flask-Security错误:" ValueError:解压缩的值太多"

时间:2018-04-30 17:04:15

标签: python flask flask-security

我已经设置了一个烧瓶安全应用,但我在创建用户和重置密码时遇到错误。

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__ 
  return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app
  response = self.handle_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception
  reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
  response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
  rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
  rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/flask_securit /decorators.py", line 230, in wrapper
  return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask_security/views.py", line 118, in register
  user = register_user(**form.to_dict())
File "/usr/local/lib/python2.7/dist-packages/flask_security/registerable.py", line 41, in register_user
  'welcome', user=user, confirmation_link=confirmation_link)
File "/usr/local/lib/python2.7/dist-packages/flask_security/utils.py", line 401, in send_mail
  mail.send(msg)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 492, in send
  message.send(connection)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 427, in send
  connection.send(self)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 188, in send
  self.host.sendmail(sanitize_address(envelope_from or message.sender),
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 105, in sanitize_address
  nm, addr = addr

ValueError: too many values to unpack    ValueError: too many values to unpack

我刚刚按照https://pythonhosted.org/Flask-Security/quickstart.html#basic-sqlalchemy-application

的指南

我需要帮助找出问题所在。

这是我的电子邮件配置:

app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USE_SSL'] = True
app.config['MAIL_USERNAME'] = 'devskovsted@gmail.com'
app.config['MAIL_PASSWORD'] = '**********'
app.config['MAIL_DEFAULT_SENDER'] = 'devskovsted@gmail.com'
mail = Mail(app)

/ Kresten

1 个答案:

答案 0 :(得分:3)

这是flask-security utils中的send_mail方法的一个已知问题,请参阅此thread

branch

已更正

解决方法是卸载flask-security并安装更新后的repo

pip install git+https://github.com/mattupstate/flask-security

当然,根据您的设置,您可能需要执行sudo pip install