Reputation: 1614
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
Upvotes: 2
Views: 649
Reputation: 2357
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='[email protected]/OR/[email protected]'
EMAIL_HOST_PASSWORD='password'
EMAIL_USE_TLS=True
Upvotes: 0
Reputation: 5713
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
Upvotes: 1