Answer the question
In order to leave comments, you need to log in
How can I fix the ConnectionAbortedError error?
I have an account login function, at first everything goes well, the data from the form reaches Django and the login occurs, but for some reason the readerect function (HttpResponseRedirect) does not work and an error appears:
Exception occurred during processing of request from ('127.0.0.1', 57962)
Traceback (most recent call last):
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\socketserver.py", line 747, in __init__
self.handle()
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
self.handle_one_request()
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "C:\Users\drygo\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] Программа на вашем хост-компьютере разорвала установленное подключение
def log_hand(request):
try:
username = request.POST['username']
password = request.POST['password']
print(type(username), type(password))
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
print('ok')
return HttpResponseRedirect('/main/')
else:
return JsonResponse({'v': 'no'})
else:
return JsonResponse({'v': 'no'})
except:
return JsonResponse({'v': 'no'})
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