from rest_framework.exceptions import APIException

class ServiceUnavailable(APIException):
    status_code = 201
    default_detail = {"username": "root", "msg": "添加用户成功"}
    default_code = "service_unavaliable"
    
class TestView(APIView):
    def get(self,request):
        raise ServiceUnavailable()

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2021-07-06
  • 2021-05-12
  • 2022-02-10
猜你喜欢
  • 2022-02-15
  • 2021-09-26
  • 2022-01-09
相关资源
相似解决方案