【问题标题】:i am gettin an error "[Errno 5] Input/output error" while running an api on django在 django 上运行 api 时出现错误“[Errno 5] 输入/输出错误”
【发布时间】:2021-09-11 08:15:31
【问题描述】:

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 的托管

【问题讨论】:

  • 您的服务器上的磁盘空间是否已用完?
  • NO 服务器上有足够的空间。

标签: python django linux cpanel


【解决方案1】:

解决了我只需要从代码中删除打印。

【讨论】:

    猜你喜欢
    • 2016-04-11
    • 2023-03-15
    • 2020-08-10
    • 2019-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    • 1970-01-01
    相关资源
    最近更新 更多