简体   繁体   中英

Reset Password in django?

I am following a blog to reset the password in django. It states to add :

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'  # During development only

in settings.py file.

But I want to deploy my web application in production. So what steps should I take care about? Will this tutorial is safe for the production too?

The blog link is given below:

https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html

You should follow the django documentation and the checklist for production deploy to be on the safer side. And as far as the tutorial goes, it is a very well explained blog for learning about django.

Django Production Deployment checklist

As it is mentioned in tutorial it is only for Development . But when you move to prodution you need to configure it properly based on your SMTP type. I'll specify it all here:

For production (DEBUG=False)

SMTP Email-    EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
Server    -    EMAIL_HOST=127.0.0.1
(Standard)-    EMAIL_PORT=25
               EMAIL_HOST_USER=<smtp_user>
               EMAIL_HOST_PASSWORD=<smtp_user_pwd>
  • If the SMTP email server is running on a network or a different port than the default, adjust EMAIL_HOST and EMAIL_PORT accordingly.

  • In today's email spam infested Internet, nearly all SMTP email servers require authentication to send email. If your SMTP server doesn't require authentication you can omit EMAIL_HOST_USER and EMAIL_HOST_PASSWORD.


Django email configuration for Gmail or Google Apps account

This is all you need to set up a default email connection to Gmail or Google Apps in Django. In your settings.py use this code with your credentials:

EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST='smtp.gmail.com'
EMAIL_PORT=587
EMAIL_HOST_USER='username@gmail.com/OR/username@coffeehouse.com'
EMAIL_HOST_PASSWORD='password'
EMAIL_USE_TLS=True

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM