52

I have the following error when I run django allauth example and it tries to send an email:

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 61] Connection refused

Under OS X 10.9.1

arthur.sw
  • 11,052
  • 9
  • 47
  • 104
  • Related error message: `No connection could be made because the target machine actively refused it` would be solved by setting up email server as shown in the accepted answer. - Added details so that this shows up in Google searches – user Jun 08 '14 at 08:01
  • My problem with django-allauth is that when i try the github project, i migrate ok but all the time says that: "You have 26 unapplied migration(s)."... the same all the time. – ret Jan 19 '23 at 15:02

2 Answers2

144

From allauth documentation:

When I sign up I run into connectivity errors (connection refused et al)

You probably have not got an e-mail (SMTP) server running on the machine you are developing on. Therefore, allauth is unable to send verification mails.

You can work around this by adding the following line to settings.py:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' This will avoid the need for an SMTP server as e-mails will be printed to the console. For more information, please refer to:

https://docs.djangoproject.com/en/dev/ref/settings/#email-backend

guettli
  • 25,042
  • 81
  • 346
  • 663
arthur.sw
  • 11,052
  • 9
  • 47
  • 104
  • 9
    +1 Thanks for this. Saved me hours of frustration. That error message does not really do justice. However after looking at your post, I went back and saw the stacktrace. Notice something about SMTP there. – Karthic Raghupathi Feb 26 '14 at 14:43
  • The email does not get sent though, it only appears in the console. – bmc Jun 03 '19 at 15:42
8

Alternatively if you have a social sign up, you probably do not require verification email so you can just add ACCOUNT_EMAIL_VERIFICATION = 'none' to your settings. This will automatically solve the problem.

christk
  • 834
  • 11
  • 23