gaierror when trying to send email with Django using Google App Engine

1,222 views
Skip to first unread message

James Brace via StackOverflow

unread,
Nov 7, 2016, 12:35:05 AM11/7/16
to google-appengin...@googlegroups.com

I have deployed a Django project on Google App Engine and have set up django-password-reset in order for users to be able to reset their password through email verification.

However, when I try to submit the recovery request I get this error:

Environment:


Request Method: POST
Request URL: https://hrlite-143801.appspot.com/forgot-password/recover/

Django Version: 1.10.1
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',
 'rest_framework',
 'compressor',
 'authentication',
 'password_reset')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')



Traceback:

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/handlers/exception.py" in inner
  39.             response = get_response(request)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/views/generic/edit.py" in post
  183.             return self.form_valid(form)

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/password_reset/views.py" in form_valid
  100.         self.send_notification()

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/password_reset/views.py" in send_notification
  96.                   [self.user.email])

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/mail/__init__.py" in send_mail
  62.     return mail.send()

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/mail/message.py" in send
  342.         return self.get_connection(fail_silently).send_messages([self])

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/mail/backends/smtp.py" in send_messages
  100.             new_conn_created = self.open()

File "/base/data/home/apps/s~hrlite-143801/1.396880033573182710/lib/django/core/mail/backends/smtp.py" in open
  58.             self.connection = connection_class(self.host, self.port, **connection_params)

File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/smtplib.py" in __init__
  250.             (code, msg) = self.connect(host, port)

File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/smtplib.py" in connect
  310.         self.sock = self._get_socket(host, port, self.timeout)

File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/smtplib.py" in _get_socket
  285.         return socket.create_connection((host, port), timeout)

File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py" in create_connection
  551.     for res in getaddrinfo(host, port, 0, SOCK_STREAM):

File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py" in getaddrinfo
  339.         canonical=(flags & AI_CANONNAME))

File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py" in _Resolve
  212.     canon, aliases, addresses = _ResolveName(name, families)

File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py" in _ResolveName
  232.     raise _SystemExceptionFromAppError(e)

Exception Type: gaierror at /forgot-password/recover/
Exception Value: [Errno 8] nodename nor servname provided, or not known

I am new to working with sockets and Google App Engine and was wondering if anyone could help me decipher this error message. Thanks



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/40458405/gaierror-when-trying-to-send-email-with-django-using-google-app-engine

Prakhar Trivedi via StackOverflow

unread,
Nov 7, 2016, 12:45:04 AM11/7/16
to google-appengin...@googlegroups.com

Add these settings in your settings.py file :

    EMAIL_HOST = 'smtp.gmail.com'
    EMAIL_USE_TLS = True
    EMAIL_HOST_USER = 'Your...@gmail.com'
    EMAIL_HOST_PASSWORD = 'password'
    EMAIL_PORT = 587
    ACCOUNT_EMAIL_VERIFICATION = 'none'

These settings are for gmail account.If you are using any other email service provider,then please customize these settings according to that.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/40458405/gaierror-when-trying-to-send-email-with-django-using-google-app-engine/40458446#40458446
Reply all
Reply to author
Forward
0 new messages