Open miurahr opened 9 years ago
電子メールのテンプレートが日本語になっていないことに気づいたので、コメントしておく。
設定を実施
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
# for debug
#EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# for production
EMAIL_BACKEND = "mailer.backend.DbBackend"
MAILER_EMAIL_BACKEND = "django.core.mail.backend.smtp.EmailBackend"
EMAIL_HOST = 'smtp.zoho.com'
EMAIL_HOST_PASSWORD = 'hogehogefugafuga'
EMAIL_HOST_USER = 'webmaster@stateofthemap.jp'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
しかし、エラーになった
Raven is not configured (logging is disabled). Please see the documentation for more information.
[2015-07-19 13:35:28 +0000] [3812] [ERROR] Socket error processing request.
Traceback (most recent call last):
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 130, in handle
self.handle_request(listener, req, client, addr)
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 187, in handle_request
six.reraise(exc_info[0], exc_info[1], exc_info[2])
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 171, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 199, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception
'request': request
File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/__init__.py", line 1271, in _log
self.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1281, in handle
self.callHandlers(record)
File "/usr/lib/python2.7/logging/__init__.py", line 1321, in callHandlers
hdlr.handle(record)
File "/usr/lib/python2.7/logging/__init__.py", line 749, in handle
self.emit(record)
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/utils/log.py", line 132, in emit
connection=self.connection())
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/mail/__init__.py", line 98, in mail_admins
mail.send(fail_silently=fail_silently)
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/mail/message.py", line 286, in send
return self.get_connection(fail_silently).send_messages([self])
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 92, in send_messages
new_conn_created = self.open()
File "/srv/sites/sotmjp-website/env/sotmjp-website/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 50, in open
self.connection = connection_class(self.host, self.port, **connection_params)
File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
EMAIL_HOST_USER = 'webmaster@stateofthemap.jp'が間違いでEMAIL_HOST_USER = 'webadmin@stateofthemap.jp'でした
参考 http://www.petitec.com/2013/08/django-dont-send-email-in-dev/ https://docs.djangoproject.com/en/dev/topics/email/#topic-email-backends