【发布时间】:2019-05-29 09:19:24
【问题描述】:
我正在使用 Django 的内置密码重置机制。它会发送一封电子邮件,其中包含一个包含令牌的链接,单击该令牌可用于重置密码。但是,正在生成的链接正在使用模板:
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
这里,{{ protocol }} 返回的是 http 而不是 https。
我的 nginx 服务器会将任何 http 请求重定向到 https 基本链接(主页)。
因此,密码重置链接不起作用,因为生成的链接错误。它只是通过 nginx 进入主页。
我该如何解决这个问题?
【问题讨论】:
标签: django python-3.x nginx