没有连接可能是因为目标机器主动拒绝它(Django) [英] No connection could be made because the target machine actively refused it (Django)

查看:926
本文介绍了没有连接可能是因为目标机器主动拒绝它(Django)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经遵循 Django Book 直到第七章,我目前正在搞砸表格GET, POST和所有的善良。有一点,指南让我弄清楚反应,表格填写并发送后,但当我发送表单数据时,我收到这个错误:

 
错误/ contact /
[Errno 10061]无法建立连接,因为目标机器主动拒绝itRequest方法:POST
请求URL:http://127.0.0.1: 8000 / contact /
Django版本:1.3
异常类型:错误
异常值:[Errno 10061]无法建立连接,因为目标机器主动拒绝它
异常位置: C:\Python27\lib\socket.py在create_connection中,第571行
Python可执行文件:C:\Python27\python.exe
Python版本:2.7.2

换句话说,直到这时我还没有出现任何端口问题。我刚刚在Windows防火墙中明确地打开了端口10061,但是没有看到它。 (我更改了规则后,我关闭并打开了 runserver 。)



我正在运行Windows 7,而我的问题的要点就是这个错误信息究竟是怎样处理的(这当然是比较理想的)。



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

解决方案

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


请注意,为了使用send_mail发送电子邮件( ),您的服务器必须配置为发送邮件,并且必须告诉Django您的出站电子邮件服务器。请参阅 http://docs.djangoproject.com/en/dev/topics/email/ 对于具体细节。


我想我没想到这是什么意思,但我指出了指南,事情最终开始点击。 / p>

感谢所有人来追踪他们的建议。这是一个无用的错误信息,我只能假设帮助我的人只知道答案,因为他们经历了完全相同的事情。


I have followed the Django Book up until chapter seven, and I am currently messing around with forms, GET, POST and all that goodness. At one point, the guide made me figure out the reaction, after a form is filled out and sent, but when I send the form data, I get this error:

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

In other words, I haven’t had any port problems up until this point. I just opened port 10061 explicitly in Windows Firewall but to no avail by the look of it. (I closed and opened the runserver, after I had changed the rules.)

I am running Windows 7, and the gist of my question is what exactly this error message means more so than how to deal with it (both are preferable, of course).

EDIT: I have also forwarded port 8000 in Windows Firewall (apply to all profiles, TCP), but I still get what looks like the same error.

解决方案

I managed to find out what the problem was (no thanks to the error message). As it turns out, I needed to set up my e-mail server:

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.

I guess I thought little of what was meant by it, but I was pointed in the direction of this guide, and things eventually started to click.

Thanks to everyone for chiming in with their advice. That is one useless error message, and I can only assume the people who helped me out only knew the answer because they had experienced the exact same thing.

这篇关于没有连接可能是因为目标机器主动拒绝它(Django)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆