问题
How can I change the domain the link inside the email djoser sends uses?
回答1:
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
来源:https://stackoverflow.com/questions/62586797/how-to-use-a-different-domain-for-djoser-email