Django Web开发中返回 HttpRespon和JsonResponse的区别 &&序列化(格式化)
JsonResponse 对象:JsonResponse(data, encoder=DjangoJSONEncoder, safe=True, json_dumps_params=None,**kwargs)data代表数据源encoder代表传输的数据格式safe=True这个属性 这是什么鬼 ?其实就是将发送的数据JSON序列化(格式化) 因为safe默认为True 只支持python的字典转化序列化,所以给他更改为False,就可以序列化其他python格式数据这个类其实是Http
原创
2022-01-21 13:42:46 ·
766 阅读 ·
0 评论