テスト用のプロジェクトをセットアップしましたがcookiecutter-django
、確認メールをコンソールに正常に出力できました。ただし、メールの実際の送信もテストすることが重要であり、ローカル テスト環境の設定を調整しようとするとSMTP AUTH extension not supported by server.
、新しいアカウントを追加した後にエラーが発生しました。
設定ファイルの関連する、、、および設定を変更EMAIL_BACKEND
しEMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
て追加しました。EMAIL_HOST
EMAIL_PORT
EMAIL_HOST_USER
EMAIL_HOST_PASSWORD
local.py
私は、この目的のために設定された yahoo アカウントを使用しており、Django 以外でも問題なく動作しました。
これを構成する方法についてのドキュメントには何も見つかりませんcookie-cutter
.Djangoのドキュメントはあまり役に立ちません.
編集して追加:
メール設定:
EMAIL_PORT = 587
EMAIL_HOST = 'smtp.mail.yahoo.com'
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
完全なトレースバック:
Internal Server Error: /accounts/signup/
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 53, in inner
return func(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 210, in dispatch
return super(SignupView, self).dispatch(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 79, in dispatch
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 188, in dispatch
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 102, in post
response = self.form_valid(form)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 231, in form_valid
self.get_success_url())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 188, in complete_signup
signal_kwargs=signal_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 151, in perform_login
send_email_confirmation(request, user, signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 319, in send_email_confirmation
signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/models.py", line 60, in send_confirmation
confirmation.send(request, signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/models.py", line 166, in send
get_adapter(request).send_confirmation_mail(request, self, signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/adapter.py", line 447, in send_confirmation_mail
ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/adapter.py", line 140, in send_mail
msg.send()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/message.py", line 348, in send
return self.get_connection(fail_silently).send_messages([self])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 104, in send_messages
new_conn_created = self.open()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 71, in open
self.connection.login(force_str(self.username), force_str(self.password))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 696, in login
"SMTP AUTH extension not supported by server.")
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.