create connection error

18 views
Skip to first unread message

miaox...@gmail.com

unread,
Sep 12, 2016, 1:36:23 PM9/12/16
to Django users
def contact(request):
error = []
if request.method == 'POST':
if not request.POST.get('subject', ''):
error.append("please enter a subject")
if not request.POST.get('message',''):
error.append("please enter a message")
if request.POST.get('email') and "@" not in request.POST["email"]:
error.append("Please enter a valid e-mail")
if not error:
# send_mail(request.POST['subject'], request.POST['message'], request.POST.get('email', 'mxb...@126.com'), ['22290...@qq.com'], fail_silently=True)
send_mail('subject', 'this is the message of email', 'mxb...@126.com', ['22290...@qq.com'], fail_silently=True)
return HttpResponseRedirect('/contact/thanks/')
return render_to_response('contact.html', {'error' : error})


STATIC_URL = '/static/'

EMAIL_POST = 'smtp.126.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'mxb...@126.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_SUBJECT_PREFTX = u''
EMAIL_USE_TLS = True

SERVER_EMAIL = '22290...@qq.com'


error at /contact/

[Errno 10061] 
Request Method:POST
Request URL:http://127.0.0.1:8000/contact/
Django Version:1.10
Exception Type:error
Exception Value:
[Errno 10061] 
Exception Location:D:\Python\lib\socket.py in create_connection, line 571
Python Executable:D:\Python\python.exe
Python Version:2.7.3
Python Path:
['C:\\Users\\miaoxu\\mysite',
 'D:\\Python\\lib\\site-packages\\django-1.10-py2.7.egg',
 'D:\\Python\\python27.zip',
 'D:\\Python\\DLLs',
 'D:\\Python\\lib',
 'D:\\Python\\lib\\plat-win',
 'D:\\Python\\lib\\lib-tk',
 'D:\\Python',
 'D:\\Python\\lib\\site-packages',
 'D:\\Python\\lib\\site-packages\\PIL',
 'D:\\Python\\lib\\site-packages\\win32',
 'D:\\Python\\lib\\site-packages\\win32\\lib',
 'D:\\Python\\lib\\site-packages\\Pythonwin']
Server time:星期一, 12 九月 2016 01:46:23 +0000


ludovic coues

unread,
Sep 12, 2016, 5:43:29 PM9/12/16
to django...@googlegroups.com
Is there anything in the console ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/789f6303-87f6-4d20-9e1b-16fa8db0e943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42
Reply all
Reply to author
Forward
0 new messages