问题
I am getting this error when i add a specific line in the post request.
views.py
class LoginVerify(View):
print('login')
email =""
pswd = ""
username =""
def post(self,request,*args,**kwargs):
print("post called")
self.email = request.POST['email']
self.pswd = request.POST['pswd']
self.username = User.objects.get(email=self.email).username
return HttpResponse("Invalid user")
If I add self.username = User.objects.get(email=self.email).username
then it is showing the error, otherwise it is working fine.
Why it is happening, how can I solve this?
回答1:
I usually get this when running on my local machine in debug mode usually happens if the server responds to a request and the client has already closed the connection. You may ignore the error or use a different production server such as gunicorn which has better server socket handling. FYI i see this error on python 2.7
来源:https://stackoverflow.com/questions/29619278/django-an-established-connection-was-aborted-by-the-software-in-your-host-mach