如何为Djoser电子邮件使用其他域? [英] How to use a different domain for Djoser email?

查看:59
本文介绍了如何为Djoser电子邮件使用其他域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改djoser发送的电子邮件中的链接所使用的域?

How can I change the domain the link inside the email djoser sends uses?

推荐答案

我想出了这一点,要更改链接域,需要将DOMAIN和SITE_NAME添加到项目设置中.示例:

I figured this out, to change the link domain you need to add DOMAIN and SITE_NAME to your project settings. Example:

DOMAIN = config('DOMAIN') #example.com
SITE_NAME = config('SITE_NAME') #Example

 DJOSER = {
    'LOGIN_FIELD':'email',
    'USER_CREATE_PASSWORD_RETYPE':True,
    'ACTIVATION_URL': '/users/activate/{uid}/{token}',
    'SEND_ACTIVATION_EMAIL': True,
    'SERIALIZERS':{
        'user_create':'userauth.serializers.UserCreateSerializer',
        'user':'userauth.serializers.UserCreateSerializer',
        'activation': 'djoser.email.ActivationEmail',
}

然后,您应该在电子邮件中获得下一个链接:

Then you should get the next link in your email:

http://example.com/auth/users/activate/MQ/5c9-26bcab9e85e8a967731d

这篇关于如何为Djoser电子邮件使用其他域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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