Could not send email with password reset using SendGrid with Django on PythonAnywhere

0

Could someone point me in the right direction on how the password reset, that is built-in with Django admin, is going to send an email for the password reset. I am using the following: PythonAnywhere for my host (FREE account) SendGrid for sending emails

This is the code in my urls

path('admin/password_reset/', auth_views.PasswordResetView.as_view(), name='admin_password_reset'),
path('admin/password_reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),

In my settings.py, I have these:

EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST_USER = my_sendgrid_username
EMAIL_HOST_PASSWORD = my_sendgrid_password
EMAIL_PORT = 587
EMAIL_USE_TLS = True

So when I use the password reset link during login, it will ask for the email address, after entering email of a registered user, I get a ConnectionRefusedError. Is there something else that I should have done? There is that send_mail() function. Should I use this? Or is that handled by django already? My site uses only the admin site so I have no other views other than the ones provided by Django admin.

mike26

Posted 2019-02-14T11:20:28.543

Reputation: 1

did you got any solution ? – giveJob – 2019-04-30T11:10:49.330

No solution yet. I have contacted SendGrid and they said they needed to verify my account. I did that and it is still not working. I have shifted to gmail as my email host instead just because it works right off the bat – mike26 – 2019-05-03T02:09:02.553

did you try using: EMAIL_BACKEND = 'sendgrid_backend.SendgridBackend' – connelblaze – 2019-06-24T16:01:58.220

No answers