Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django Allauth Fails in Development Environment #65

Closed
UPstartDeveloper opened this issue Jul 26, 2020 · 1 comment
Closed

Django Allauth Fails in Development Environment #65

UPstartDeveloper opened this issue Jul 26, 2020 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@UPstartDeveloper
Copy link
Collaborator

Tinydoor seems unable to sign up or login new users when it's running on localhost. I have also tried to create a superuser and then send a Forgot Password email, and this function also causes the app to crash in the development environment.

The error that's shown in the debug pages is:

ConnectionRefusedError at <URL path>
[Errno 61] Connection refused

These functions do work on the deployed website, my hunch is that we may just need to set up the same tools (such as Mailhog) to work on the local version. I will look more into this, it seems like a common issue on the django-allauth repo, as indicated by the discussion on this issue.

@UPstartDeveloper UPstartDeveloper added bug Something isn't working help wanted Extra attention is needed labels Jul 26, 2020
@UPstartDeveloper UPstartDeveloper added this to the User Dashboard milestone Jul 26, 2020
@UPstartDeveloper UPstartDeveloper self-assigned this Jul 26, 2020
@UPstartDeveloper UPstartDeveloper added this to To do in Engineering Sprints via automation Jul 26, 2020
@UPstartDeveloper
Copy link
Collaborator Author

Hey team! Good news!

The Fix

To fix this I am going to switch the EMAIL_BACKEND setting from defaulting to the SMTP setting, to just printing the message to the console.

The Explanation

So as @scuerda mentions on the issue I linked above, a simple fix to this bug is to set

EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend')

This setting will print the email message that new users receive to confirm their email, on the console where you're running python manage.py runserver. These messages are the same as if we actually sent an email, so the links are perfectly functional!

On line 218 of the config/settings/base.py file, we have already set the email backend to SMTP, however, that's not what's used in production if I understand correctly, Mailgun is. So it doesn't really serve any purpose.

I will be changing this:

217          EMAIL_BACKEND = env(
218               "DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend"
219          )

to this:

217          EMAIL_BACKEND = env(
218               "DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
219          )

So hopefully this will make it easier for us to work with auth in development going further, especially when it comes to building the dashboard. Cheers!

Engineering Sprints automation moved this from To do to Done Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Development

No branches or pull requests

1 participant