[英]DJANGO: Set site_id to sites pk
I am following this tutorial for email verification.The version the author is working with is old.I got an error that said Reverse for 'activate' with keyword arguments '{'uidb64': b'OA', 'token': '4tm-3fcfb375c8ba14f9a95b'}
.我正在关注本教程进行电子邮件验证。作者正在使用的版本是旧版本。我收到一个错误,提示
Reverse for 'activate' with keyword arguments '{'uidb64': b'OA', 'token': '4tm-3fcfb375c8ba14f9a95b'}
。 I got that fixed through the first comment .我通过第一条评论解决了这个问题。 The email got sent .But the link led to www.example.com .
电子邮件已发送。但链接指向www.example.com 。 The second comment tells how to fix that .
第二条评论告诉了如何解决这个问题。 The comment was : For those are using Django 3, You should change some code
评论是:对于那些使用 Django 3 的人,你应该更改一些代码
But I did not understand how to set SITE_ID to my sites pk.但我不明白如何将 SITE_ID 设置为我的网站 pk。
In settings.py
set在
settings.py
设置
BASE_URL = 'https://www.yourdomainname.com'
Don't include trailing /
Also, you have to mention this line in the same file不要包括尾随
/
另外,你必须在同一个文件中提到这一行
SITE_ID = 1
Moreover, go to your django admin
pannel , default is /admin
, and go to the sites
tab/model and add/edit your site
according to your ip/domainName
and display name
.此外,转到您的
django admin
面板,默认为/admin
,然后转到sites
选项卡/模型并根据您的ip/domainName
和display name
添加/编辑您的site
。 This is the important part
to do.这是要做的
important part
。
If you are testing locally for now then you can use 127.0.0.1:8000
in your ip/domainName
and yourdomainNAme.com
in display name
如果您现在在本地进行测试,那么您可以在
ip/domainName
使用127.0.0.1:8000
,在display name
yourdomainNAme.com
If you are deploying or using live then you can use actual ip of your server into ip/domainname
or also you can use your domain name (as it's mapped to your ip via DNS system) and display name will be the same.如果您正在部署或使用实时,那么您可以将服务器的实际 ip 使用到
ip/domainname
或者您也可以使用您的域名(因为它通过 DNS 系统映射到您的 ip)并且显示名称将相同。
Hope, it will resolve your problem or issue.希望,它会解决您的问题或问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.