0

My password reset feature was working fine in development, sending a password reset email, but now that I have deployed to PythonAnywhere, I am getting a ConnectionRefusedError, specifically:

ConnectionRefusedError at /reset_password [Errno 111] Connection refused Request Method: POST Django Version: 4.1 Exception Type: ConnectionRefusedError Exception Value:
[Errno 111] Connection refused Exception Location: /usr/local/lib/python3.10/socket.py, line 833, in create_connection Raised during: django.contrib.auth.views.PasswordResetView Python Executable: /usr/local/bin/uwsgi Python Version: 3.10.5 Python Path:
['/var/www', '.', '', '/var/www', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/home/gridsquid/.virtualenvs/myvirtualenv/lib/python3.10/site-packages', '/home/gridsquid/gridsquid'] Server time: Sat, 12 Nov 2022 16:45:30 +0000

I have verified the user is a valid user with a working email address.

in settings.py:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'apikey' # Name for all the SenGrid accounts
EMAIL_HOST_PASSWORD = os.getenv('SENDGRID_API_KEY')

in urls.py

path("reset_password",
    auth_views.PasswordResetView.as_view(template_name="gridsquid/reset-password.html"),
    name="password_reset"),
path("reset_password_sent",
    auth_views.PasswordResetDoneView.as_view(template_name="gridsquid/reset-password-sent.html"),
    name="password_reset_done"),
path("reset/<uidb64>/<token>",
    auth_views.PasswordResetConfirmView.as_view(template_name="gridsquid/reset.html"),
    name="password_reset_confirm"),
path("reset_password_complete",
    auth_views.PasswordResetCompleteView.as_view(template_name="gridsquid/reset-password-complete.html"),
    name="password_reset_complete"),

Again, everything is working in my development environment. What could be wrong here?

1 Answer 1

0

Free accounts cannot send smtp email from PythonAnywhere

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.