Please help me to resolve this issue .............................[WinError 10061] No connection could be made because the target machine actively refused it

99 views
Skip to first unread message

Waqas Ahmad

unread,
Aug 28, 2019, 6:38:29 AM8/28/19
to Django users
Environment:


Request Method: POST

Django Version: 2.2.4
Python Version: 3.7.1
Installed Applications:
['crispy_forms',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'registration',
 'django.contrib.admin',
 'user',
 'bootstrap4']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\exception.py" in inner
  34.             response = get_response(request)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\generic\base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\decorators.py" in _wrapper
  45.         return bound_method(*args, **kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\decorators\debug.py" in sensitive_post_parameters_wrapper
  76.             return view(request, *args, **kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\views.py" in dispatch
  53.         return super(RegistrationView, self).dispatch(request, *args, **kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\generic\base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\generic\edit.py" in post
  142.             return self.form_valid(form)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\views.py" in form_valid
  56.         new_user = self.register(form)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\backends\default\views.py" in register
  100.             request=self.request,

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\models.py" in create_inactive_user
  193.                     lambda: registration_profile.send_activation_email(

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\transaction.py" in __exit__
  284.                     connection.set_autocommit(True)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py" in set_autocommit
  410.             self.run_and_clear_commit_hooks()

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py" in run_and_clear_commit_hooks
  636.             func()

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\models.py" in <lambda>
  194.                         site, request)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\registration\models.py" in send_activation_email
  451.         email_message.send()

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\message.py" in send
  291.         return self.get_connection(fail_silently).send_messages([self])

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\backends\smtp.py" in send_messages
  103.             new_conn_created = self.open()

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\mail\backends\smtp.py" in open
  63.             self.connection = self.connection_class(self.host, self.port, **connection_params)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\smtplib.py" in __init__
  251.             (code, msg) = self.connect(host, port)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\smtplib.py" in connect
  336.         self.sock = self._get_socket(host, port, self.timeout)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\smtplib.py" in _get_socket
  307.                                         self.source_address)

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\socket.py" in create_connection
  727.         raise err

File "C:\Users\Waqas Ahmad\AppData\Local\Programs\Python\Python37\lib\socket.py" in create_connection
  716.             sock.connect(sa)

Exception Type: ConnectionRefusedError at /accounts/register/
Exception Value: [WinError 10061] No connection could be made because the target machine actively refused it

Kasper Laudrup

unread,
Aug 28, 2019, 7:28:12 AM8/28/19
to django...@googlegroups.com
Hi Wagas,

This can only be a guess, since you haven't provided much relevant
information, but this exception:

> *Exception Type: ConnectionRefusedError at /accounts/register/*
> *Exception Value: [WinError 10061] No connection could be made because
> the target machine actively refused it*

is being thrown somewhere around here:

> *
> *File "C:\Users\Waqas
> Ahmad\AppData\Local\Programs\Python\Python37\lib\smtplib.py" in __init__*
> *  251.             (code, msg) = self.connect(host, port)*
> *

I assume you are trying to send an email and haven't configured your
SMTP server correctly?

Fix that in your settings.

Kind regards,

Kasper Laudrup
Reply all
Reply to author
Forward
0 new messages