python - 无法建立连接,因为目标机器主动拒绝它(Django)

标签 python django django-email

我已经关注了 Django Book直到第 7 章,我目前正在处理表单、GET、POST 和所有这些美好的事情。有一次,指南让我弄清楚填写并发送表单后的 react ,但是当我发送表单数据时,我收到此错误:

error at /contact/
[Errno 10061] No connection could be made because the target machine actively refused itRequest Method: POST
Request URL:    http://127.0.0.1:8000/contact/
Django Version: 1.3
Exception Type: error
Exception Value:    [Errno 10061] No connection could be made because the target machine actively refused it
Exception Location: C:\Python27\lib\socket.py in create_connection, line 571
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.2

换句话说,到目前为止我还没有遇到任何端口问题。我刚刚在 Windows 防火墙中显式打开了端口 10061,但看起来无济于事。 (在更改规则后,我关闭并打开了 runserver。)

我运行的是 Windows 7,我的问题的要点是这个错误消息到底意味着什么,而不是如何处理它(当然,两者都是可取的)。

编辑:我还在 Windows 防火墙中转发了端口 8000(适用于所有配置文件,TCP),但我仍然收到看起来相同的错误。

最佳答案

我设法找出问题所在(不,感谢错误消息)。事实证明,我需要设置我的电子邮件服务器:

Note that in order to send e-mail using send_mail(), your server must be configured to send mail, and Django must be told about your outbound e-mail server. See http://docs.djangoproject.com/en/dev/topics/email/ for the specifics.

我想我没怎么想它的意思,但我被指向了 this 的方向指导,事情最终开始顺利。

感谢每个人 提出他们的建议。这是一条无用的错误消息,我只能假设帮助我的人知道答案,因为他们经历过完全相同的事情。

关于python - 无法建立连接,因为目标机器主动拒绝它(Django),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6782732/

相关文章:

python - 通过双卡尔曼滤波器进行状态估计

python - 如何查看是否有评论

python - Pandas N 元语法到列

python - 从虚拟环境中在 PyCharm 中注册 VCS 根?

Django default_from_email 名称

python - Theano 循环错误 : Outputs_info dim and fn output dim mismatch in scan

python - Django操作错误: no such column

Django:使用后如何删除 token ?

python - Django : Send mail failed

python - 服务器不支持 STARTTLS 扩展 - 尝试通过 Django 和私有(private)电子邮件地址发送电子邮件时出现此错误