2016-11-07 15 views
0

Google App EngineにDjangoプロジェクトを導入しました。しかしGoogle App Engineを使用してDjangoで電子メールを送信しようとしたときに、

、私はこのエラーを取得し回復要求提出しようとすると:

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 

私はソケットとGoogleのApp Engineとの作業に新しいですし、誰も私がこのエラーメッセージを解読する手助けができればと思いました。おかげ

答えて

2

があなたのsettings.pyファイルでこれらの設定を追加します。

EMAIL_HOST = 'smtp.gmail.com' 
    EMAIL_USE_TLS = True 
    EMAIL_HOST_USER = '[email protected]' 
    EMAIL_HOST_PASSWORD = 'password' 
    EMAIL_PORT = 587 
    ACCOUNT_EMAIL_VERIFICATION = 'none' 

これらの設定はGmailのためのものであるあなたが、他のメールサービスプロバイダを使用しているaccount.If、その後、それに応じてこれらの設定をカスタマイズしてください。

+0

男、ありがとうございました。あなたは命の恩人です。 –

+0

@JamesBraceいつも幸せに助けてください:) –

関連する問題