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

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

问题描述

我在端口 8001 上运行 django,而 nginx 正在处理端口 80 上的网络服务器职责.nginx 代理视图和对 Django 的一些 REST api 调用.我正在使用 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/confirm-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

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

How can I make the url look like 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天全站免登陆