我正在通过nginx提供一个反向代理的django应用程序。该应用程序在映射到example.com的本地主机下运行:8686。因此,重置密码的正确链接如下所示:
https://example.com:8686/accounts/reset/MQ/591-05377c39db92f2d5368a/但邮件中的内容是这样的:
https://localhost:8686/accounts/reset/MQ/591-05377c39db92f2d5368a/显然,django (本地有女服务员)并不知道域名。有没有可能告诉django它应该使用哪个域名?
发布于 2019-08-21 06:44:39
第一种方法是通过创建自定义registration/password_reset_email.html来覆盖默认模板
{# yourProject/yourApp/templates/registration/password_reset_email.html #}
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://domain.com{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}另一种方法是启用“站点框架”(参见链接#2)。
文档和来源:
https://stackoverflow.com/questions/57582155
复制相似问题