我是Django的新手,并使用django-rest-passwordreset库为rest实现了密码重置端点。它的工作原理很棒,但我想自定义我的电子邮件中返回的url,在路径和令牌之前包含"https://“和域名”,以便在电子邮件中显示完整的URL。
到目前为止,电子邮件给我发了一条这样的路径:
/password-reset/?token=random_string_of_characters_are_here
我希望它能给我发这样的邮件:
https://mywebsite.com/password-reset/?token=random_string_of_characters_are_here
发布于 2022-06-13 18:14:26
我所做的是在上下文中添加url:
from django.conf import settings
context.update({"FRONT_URL": settings.FRONT_URL})
content = render_to_string("emails/reset.html".format(template), context)我在FRONT_URL中填充了settings.py,我可以在模板中使用{{ FRONT_URL }}。
我使用context.update,所以我只需将FRONT_URL添加到其他context值
https://stackoverflow.com/questions/72604227
复制相似问题