我正在通过nginx为带有反向代理的Django应用提供服务。该应用程序在本地localhost:8686下运行,该本地主机映射到example.com。因此,重设密码的正确链接类似于:
https://example.com:8686/accounts/reset/MQ/591-05377c39db92f2d5368a/
但这是电子邮件中显示的内容:
https://localhost:8686/accounts/reset/MQ/591-05377c39db92f2d5368a/
很显然,django(本地与女服务员一起工作)不了解域名。可以告诉django应该使用哪个域名吗?
答案 0 :(得分:0)
要做的第一件事是通过创建自定义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)。
文档和来源: