pythondjangodjango-email

No connection could be made because the target machine actively refused it (Django)


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.


Solution

  • 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.