Django API 代码:
def post(self,request)-> JsonResponse:
try:
self.email = request.data['email']
self.mobile = request.data['mobile']
self.password = request.data['password']
except Exception as e:
return JsonResponse(create_failure('400',f"invalid payload {e}","fail"))
try:
res = {}
jwt_token = ''
if self.email:
password = Customer.objects.get(email=self.email).password
username = Customer.objects.get(email=self.email).username
print(password)
if check_password(self.password,password) :
jwt_token = make_jwt_token({'username':username})
else:
return JsonResponse(create_failure('500',f"Invalid password","fail"))
elif self.mobile:
password = Customer.objects.get(mobile=self.mobile).password
username = Customer.objects.get(mobile=self.mobile).username
if check_password( password,self.password) :
jwt_token = make_jwt_token({'username':username})
else:
return JsonResponse(create_failure('500',f"Invalid password","fail"))
res['token'] = jwt_token
except Exception as e:
return JsonResponse(create_failure('400',f"error in verifying the password {e}","fail"))
return JsonResponse(create_success('User Verified',res))
在邮递员上运行时出错
{
"StatusCode": "400",
"Message": "error in verifying the password [Errno 5] Input/output error",
"ReplyCode": "fail",
"Data": []
}
上面的代码在本地计算机上运行良好,但是当我将其部署到服务器时,它会产生此错误。我正在使用 cpanel 作为使用 CentOS 的托管