django-allauth:如何修改邮件确认网址? [英] django-allauth: how to modify email confirmation url?

查看:137
本文介绍了django-allauth:如何修改邮件确认网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在端口8001上运行django,而nginx正在处理端口80上的网络服务器任务.nginx代理视图和一些REST api调用Django。我正在使用django-allauth进行用户注册/认证。

I'm running django on port 8001, while nginx is handling webserver duties on port 80. nginx proxies views and some REST api calls to Django. I'm using django-allauth for user registration/authentication.

当一个新用户注册时,django-allauth向用户发送一个包含点击链接的电子邮件。因为django在端口8001上运行,链接看起来像 http:// machine-hostname:8001 / accounts / confirmation-email / xxxxxxxxxxxxxx

When a new user registers, django-allauth sends the user an email with a link to click. Because django is running on port 8001, the link looks like http://machine-hostname:8001/accounts/confirm-email/xxxxxxxxxxxxxx

如何使网址看起来像 http://www.example.com/accounts/confirm-email/xxxxxxxx

谢谢!

推荐答案

Django从HTTP标头获取主机名和端口。
在选项 proxy_pass 之前,将 proxy_set_header Host $ http_host; 添加到您的nginx配置中。

Django get hostname and port from HTTP headers. Add proxy_set_header Host $http_host; into your nginx configuration before options proxy_pass.

这篇关于django-allauth:如何修改邮件确认网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆