我正在尝试使用 Flask-Mail 从烧瓶我的应用程序发送电子邮件。当我从开发服务器运行它时,我的代码运行良好,但是当我使用 uwsgi 和 nginx 部署它时,我不再可以发送电子邮件。提供错误回溯。我该如何解决这个问题?
Traceback (most recent call last):
File "./resources/forget_password.py", line 41, in post
mail.send(msg)
File "/home/www/shopolot/env/local/lib/python2.7/site-packages/flask_mail.py", line 491, in send
with self.connect() as connection:
File "/home/www/shopolot/env/local/lib/python2.7/site-packages/flask_mail.py", line 144, in __enter__
self.host = self.configure_host()
File "/home/www/shopolot/env/local/lib/python2.7/site-packages/flask_mail.py", line 158, in configure_host
host = smtplib.SMTP(self.mail.server, self.mail.port)
File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused