I'm new with Django an Python.
I was following this tutorial "Try Django 16"
I don't get it work. I added fail_silent=false
to get the error.
[Errno 8] nodename nor servname provided, or not known
Is there anyone who can help me find this problem?
gaierror at /thank-you/
[Errno 8] nodename nor servname provided, or not known
Request Method: POST
Request URL: http://127.0.0.1:8000/thank-you/
Django Version: 1.6.5
Exception Type: gaierror
Exception Value:
[Errno 8] nodename nor servname provided, or not known
Exception Location: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py in create_connection, line 553
Python Executable: /usr/bin/python
Python Version: 2.7.5
Python Path:
['/Users/andremensink/Desktop/skillshare/src',
'/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
'/Library/Python/2.7/site-packages']
Server time: Sat, 28 Jun 2014 13:23:10 +0000
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/thank-you/
Django Version: 1.6.5
Python Version: 2.7.5
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'signups')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/andremensink/Desktop/skillshare/src/signups/views.py" in thankyou
40. send_mail(subject,message,from_email,to_list,fail_silently=False)
File "/Library/Python/2.7/site-packages/django/core/mail/__init__.py" in send_mail
50. connection=connection).send()
File "/Library/Python/2.7/site-packages/django/core/mail/message.py" in send
274. return self.get_connection(fail_silently).send_messages([self])
File "/Library/Python/2.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
87. new_conn_created = self.open()
File "/Library/Python/2.7/site-packages/django/core/mail/backends/smtp.py" in open
48. local_hostname=DNS_NAME.get_fqdn())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py" in __init__
250. (code, msg) = self.connect(host, port)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py" in connect
310. self.sock = self._get_socket(host, port, self.timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py" in _get_socket
285. return socket.create_connection((host, port), timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py" in create_connection
553. for res in getaddrinfo(host, port, 0, SOCK_STREAM):
Exception Type: gaierror at /thank-you/
Exception Value: [Errno 8] nodename nor servname provided, or not known
The code in python is:
#--django stuff
from django.conf import settings
from django.contrib import messages
from django.core.mail import send_mail #EmailMessage#send_mail
from django.shortcuts import render, render_to_response, RequestContext, HttpResponsePermanentRedirect
subject = 'This is the subject'
message = 'Welcome to the list and enjoy your product.\n This is the message.'
from_email = settings.EMAIL_HOST_USER
to_list = [save_it.email,settings.EMAIL_HOST_USER]
send_mail(subject,message,from_email,to_list,fail_silently=False)
in the settings is defined:
#for gmail or google apps
EMAIL_USE_TLS = True
EMAIL_HOST = 'smpt.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
ACCOUNT_EMAIL_VERIFICATION = 'none'
EMAIL_HOST = 'smpt.gmail.com'
What is smpt?
should be EMAIL_HOST = 'smtp.gmail.com'
http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With