django rest身份验证密码重置在电子邮件中发送错误域

django rest身份验证密码重置在电子邮件中发送错误域,django,django-rest-framework,django-allauth,django-rest-auth,Django,Django Rest Framework,Django Allauth,Django Rest Auth,我正在尝试使用django rest auth在本地主机上测试密码重置配置。电子邮件验证和注册工作,我可以触发密码重置事件并发送电子邮件,但电子邮件包含错误的域。现在它正在传递一个包含my site.com的链接作为域,而不是0.0.0:8000作为域。我在docker容器中运行应用程序,这就是为什么它是0.0.0.0:8000而不是127.0.0.1:8000 当前结果: You're receiving this email because you requested a password

我正在尝试使用django rest auth在本地主机上测试密码重置配置。电子邮件验证和注册工作,我可以触发密码重置事件并发送电子邮件,但电子邮件包含错误的域。现在它正在传递一个包含
my site.com
的链接作为域,而不是
0.0.0:8000
作为域。我在docker容器中运行应用程序,这就是为什么它是
0.0.0.0:8000
而不是
127.0.0.1:8000

当前结果:

You're receiving this email because you requested a password reset for your user account at My Site.

Please go to the following page and choose a new password:

http://my-site.com/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/

Your username, in case you've forgotten: testaccount

Thanks for using our site!

The My Site team
预期结果

You're receiving this email because you requested a password reset for your user account at My Site.

Please go to the following page and choose a new password:

http://0.0.0.0:8000/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/

Your username, in case you've forgotten: testaccount

Thanks for using our site!

The My Site team
我的注册url文件是:

from django.urls import path, include
from allauth.account.views import ConfirmEmailView
from . import views

urlpatterns = [
    path('registration/account-email-verification-sent/', views.null_view, name='account_email_verification_sent'),
    path('registration/account-confirm-email/<key>', ConfirmEmailView.as_view(), name='account_confirm_email'),
    path('registration/complete/', views.complete_view, name='account_confirm_complete'),
    path('password-reset/confirm/(<uidb64>/<token>/', views.null_view, name='password_reset_confirm'),
    path('', include('rest_auth.urls')),
    path('registration/', include('rest_auth.registration.urls')),
]
从django.url导入路径,包括
从allauth.account.views导入ConfirmEmailView
从…起导入视图
URL模式=[
路径('registration/account email verification sent/',views.null_view,name='account_email_verification_sent'),
路径('registration/account confirm email/',ConfirmEmailView.as_view(),name='account_confirm_email'),
路径('registration/complete/',views.complete\u view,name='account\u confirm\u complete'),
路径('password-reset/confirm/(/”,views.null\u view,name='password\u reset\u confirm'),
路径(“”,include('rest\u auth.url')),
路径('registration/',包括('rest\u auth.registration.url'),
]
我看到另一篇文章建议更改站点id,但我不确定这是否正确

如何使其通过当前服务的域而不是站点id域?

简易解决方案 第1步:转到
/admin/sites/site/
,您将看到如下类似内容:,

步骤2:使用以下值编辑现有条目,然后将其保存
域名:0.0.0.0:8000
显示名称:您的站点名称

你的
PasswordResetView
类在哪里?它在你的url.py中的定义在哪里?这不包括在
django allauth
视图中吗?我的
allauth.url
包含在我的
帐户/
url中,当密码重置发生时会触发,或者至少我认为是这样。我添加了该网站,但它仍然在重定向到第一个站点,而不是我刚才添加的站点。添加或编辑?我刚刚添加了0.0.0.0:8000,但是密码重置发送的url仍然指向
my site.com
。是的…在设置中更改
site\u ID=2
。问题是,Django使用密码重置模板中的
site\u ID