django-allauth:如何修改邮件确认网址? [英] django-allauth: how to modify email confirmation url?
问题描述
我正在端口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屋!