Answer the question
In order to leave comments, you need to log in
How to fix ConnectionAbortedError in django?
In general, I send an e-mail to the user, but the traceback gives an error.
ConnectionAbortedError: [WinError 10053] A program on your host machine aborted an established connection
AttributeError: 'bool' object has no attribute 'splitlines'
def profile_email_update(request, username):
if username == request.user.username:
ce = ProfileChangeEmailForm(request.POST)
if ce.is_valid():
user_id = User.objects.get(username=username)
email = ce.cleaned_data['email']
key_model = EmailVerification.objects.create(user=user_id, new_email=email)
key_model.save()
subj = 'Сменить мыло'
mess = '<h1>Hi!!!!</h1>' \
'The link is <a href="127.0.0.1/email-confirm/{}/">here</a>'.format(key_model.key)
send_mail(subj, mess, settings.EMAIL_HOST_USER, [email], fail_silently=False, html_message=True)
return JsonResponse({'success': True})
return JsonResponse({
'success': False,
'errors': dict(ce.errors.items()),
})
Traceback (most recent call last):
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\gh0st\PycharmProjects\ss\newSS\main\views.py", line 779, in profile_email_update
send_mail(subj, mess, settings.EMAIL_HOST_USER, [email], fail_silently=False, html_message=True)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\__init__.py", line 60, in send_mail
return mail.send()
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 291, in send
return self.get_connection(fail_silently).send_messages([self])
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\backends\smtp.py", line 110, in send_messages
sent = self._send(message)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\backends\smtp.py", line 124, in _send
message = email_message.message()
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 254, in message
msg = self._create_message(msg)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 443, in _create_message
return self._create_attachments(self._create_alternatives(msg))
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 453, in _create_alternatives
msg.attach(self._create_mime_attachment(*alternative))
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 368, in _create_mime_attachment
attachment = SafeMIMEText(content, subtype, encoding)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 166, in __init__
MIMEText.__init__(self, _text, _subtype=_subtype, _charset=_charset)
File "C:\Users\gh0st\AppData\Local\Programs\Python\Python37-32\lib\email\mime\text.py", line 42, in __init__
self.set_payload(_text, _charset)
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\mail\message.py", line 176, in set_payload
for l in payload.splitlines()
AttributeError: 'bool' object has no attribute 'splitlines'
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 7597)
Traceback (most recent call last):
File "C:\Users\gh0st\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\gh0st\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\gh0st\AppData\Local\Programs\Python\Python37-32\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\Users\gh0st\PycharmProjects\ss\venv\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "C:\Users\gh0st\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] Программа на вашем хост-компьютере разорвала установленное подключение
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question