Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'sendgrid_backend' in django

When sending an email on heroku I get this error:

No module named 'sendgrid_backend'

I have this set up in settings.py:

EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"
SENDGRID_API_KEY = os.environ.get("SENDGRID_API_KEY")
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = os.environ.get('SENDGRID_API_KEY')

I also did install of sendgrid using pip and included it in the requirements.txt

like image 694
user8802333 Avatar asked Oct 29 '25 11:10

user8802333


1 Answers

I think this will help you First, install the package

pip install sendgrid-django

and then create requirements.txt, email backend should be like this

EMAIL_BACKEND = "sgbackend.SendGridBackend"

or you can also do this

pip install django-sendgrid-v5
# https://github.com/sklarsa/django-sendgrid-v5
EMAIL_BACKEND = 'sendgrid_backend.SendgridBackend'
SENDGRID_API_KEY = '<SENDGRID_API_KEY>'

I think you should follow this

like image 114
Mohit Chandel Avatar answered Nov 01 '25 02:11

Mohit Chandel



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!