Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

Django Error:No connection could be made because the target machine actively refused it

Error
yesterday i signup using django allauth package but after sign up i got error.
No connection could be made because the target machine actively refused it (Django)

ConnectionRefusedError at /signup/
[WinError 10061] No connection could be made because the target machine actively refused it
Request Method: POST
Request URL: http://localhost:8000/signup/
Django Version: 4.1.9
Exception Type: ConnectionRefusedError
Exception Value:

[WinError 10061] No connection could be made because the target machine actively refused it
Exception Location: C:\Users\NISCHAY KUMAR\AppData\Local\Programs\Python\Python311\Lib\socket.py, line 836, in create_connection
Raised during: allauth.account.views.SignupView
Python Executable: C:\Users\NISCHAY KUMAR\AppData\Local\Programs\Python\Python311\python.exe
Python Version: 3.11.3
Python Path:

['C:\cotocus\python\myproject',
'C:\Users\NISCHAY '
'KUMAR\AppData\Local\Programs\Python\Python311\python311.zip',
'C:\Users\NISCHAY KUMAR\AppData\Local\Programs\Python\Python311\DLLs',
'C:\Users\NISCHAY KUMAR\AppData\Local\Programs\Python\Python311\Lib',
'C:\Users\NISCHAY KUMAR\AppData\Local\Programs\Python\Python311',
'C:\Users\NISCHAY '
'KUMAR\AppData\Local\Programs\Python\Python311\Lib\site-packages']
Server time: Thu, 01 Jun 2023 07:22:07 +0000
Traceback Switch to copy-and-paste view

Image description

Solution
some dependency missing from settings.py
Add in settings.py

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Enter fullscreen mode Exit fullscreen mode
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend"
)
Enter fullscreen mode Exit fullscreen mode

Reference

Top comments (0)