Customized password_reset_email.txt not used by app


#1

Hey everyone! Been enjoying the book. So I was trying to customize the password_reset_email.txt and realize that no matter what I did, the change is not reflected. I suspect that the app is using a default password_reset_email.txt from the auth library rather than the one we provided (as per the book).

Help anyone?

P.s. hooray for the Hello Web Design book! Proud to be a backer! Looking forward to it.


#2

ok I managed to solve this by changing the file format of password_reset_email.txt to .html. However I’ve now met with another problem.

I’m trying to send the email in Chinese language and it’s been giving me an UnicodeEncodeError ‘ascii’ codec can’t encode characters in position 315-316: ordinal not in range(128)

Has anyone tried sending an email in another language and succeeded?


#3

Re: your default file question, interesting — that’s one of the reasons why I say to put collection at the top of your INSTALLED_APPS because that’s one of the ways to tell Django to use the collection template files rather than the default ones. Do you have that?

I’m trying to send the email in Chinese language and it’s been giving me an UnicodeEncodeError ‘ascii’ codec can’t encode characters in position 315-316: ordinal not in range(128)

I have a friend who might know the answer to that, I’ll ask them to come in and comment!


#4

Hiya,

Could you post the full error stack?

You’ll need to make sure the content in the password_reset_email.html is encoded properly. Alternatively, you could use Django’s translation facilities to internationalize your content to Chinese. Take a look at:

https://docs.djangoproject.com/en/1.10/topics/i18n/translation/, specifically the “Internationalization: in template code” section.

Worst case, if you’re stuck, you can use English placeholders for now and then do the translation stuff at the very end. :)


#5

Yes I used the translation tags throughout the site I’m building and everything else is fine except this email portion. So, I’m moving on with English placeholders for now because I realized that, the problem might not actually be in the email but due to the fact that the app currently outputs the email to console which doesn’t encode Chinese characters. I’ll test this again when I deploy to a staging server and smtp.


#6

Good luck! :)


#7

If I may ask something off topic, what’s the name of this discussion framework (API? Not sure whats the right term) ?

Seems really nifty to have these boards for small community sites!


#8

Yes it’s great!

It’s Discourse and I pretty much followed this tutorial verbatim to launch it on Digitalocean. Super easy and good because I’m not very skilled with deploying to servers. :)