from django.http import HttpResponse, JsonResponse def make_json_response(code=200, **kwargs): if 'error' in kwargs: print(kwargs.get('error')) return JsonResponse({'code': code, **kwargs}, json_dumps_params={"ensure_ascii": False})