我正在使用nginx和uwsgi在远程服务器上运行Django项目。在我的local_settings.py
我有这个:
###############
# EMAIL SETUP #
###############
ADMIN_EMAIL = "admin@mydomain.com"
SUPPORT_EMAIL = "support@mydomain.com"
DEFAULT_FROM_EMAIL = SUPPORT_EMAIL
SERVER_EMAIL = SUPPORT_EMAIL
EMAIL_HOST = 'mail.privateemail.com'
EMAIL_HOST_USER = DEFAULT_FROM_EMAIL
EMAIL_HOST_PASSWORD = 'my password here'
EMAIL_PORT = 465
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
当我在Django的password_reset
模板中填写并提交表单时,不会发送任何电子邮件。相反,我在uwsgi.log
中看到了这一点。
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Subject: Password reset on Default
From: webmaster@localhost
To: my.personal@gmail.com
Date: Wed, 16 May 2018 16:55:23 -0000
Message-ID: <20180516165523.3354.76044@rbpb-dev.mydomain.com>
Hello,
You received this email because a request was made to reset the password.
If you requested this, go to the following page and choose a new password: https://127.0.0.1:8000/reset/MQ/4w8-0373d185ce41dcdb0b63/
Your username: my.personal@gmail.com
Thank you.
-------------------------------------------------------------------------------
当我在本地计算机上运行我的Django项目时填写表单并提交它,我实际上在指定的gmail帐户上收到了一封电子邮件。
这里发生了什么?
答案 0 :(得分:0)
运行这些命令似乎可以解决问题:
sudo service uwsgi restart
sudo service nginx configtest && sudo service nginx restart