Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Djoser use a different domain in emails

I have a VueJS/Django rest framework application and working on the confirmation email when a user signup.

My frontend is on another URL than my backend so I try to configure djoser to put the activation link with the good domain.

I finally managed to do it kind of adding DOMAIN and SITE_NAME informations but the result is not as expected because my domain name is surrounded by brackets.

In my settings Django I have:

DOMAIN = 'localhost:8080',
SITE_NAME = 'Frontend',
DJOSER = {
    'PASSWORD_RESET_CONFIRM_URL': '#/password/reset/confirm/{uid}/{token}',
    'USERNAME_RESET_CONFIRM_URL': '#/username/reset/confirm/{uid}/{token}',
    'ACTIVATION_URL': 'activate/{uid}/{token}',
    'SEND_ACTIVATION_EMAIL': True,
    'SERIALIZERS': {},
}

But the result in the email is:

You're receiving this email because you need to finish activation process on ('Frontend',).

Please go to the following page to activate account:

http://('localhost:8080',)/activate/MzE/an7e2w-73af66245317921904307cc266f4983e

Thanks for using our site!

The ('Frontend',) team

Does anyone have an idea why these brackets pop here?

like image 608
Tartempion34 Avatar asked Oct 19 '25 13:10

Tartempion34


1 Answers

Instead of:

DOMAIN = 'localhost:8080',

SITE_NAME = 'Frontend',

try without comma.

DOMAIN = 'localhost:8080'
SITE_NAME = 'Frontend'

A comma form a tuple.

like image 125
Aprimus Avatar answered Oct 22 '25 03:10

Aprimus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!