一、从前端传过来的数据
1.request.POST
数据类型:<QueryDict: {}>
往往为空,原因参考:https://blog.youkuaiyun.com/liuxingen/article/details/54176205
2.request.GET
数据类型:<QueryDict: {}>
往往为空
3.request.body
数据类型:<bytes>
b'{"":""}
这往往需要使用json处理一下,loads的对象只能是str、bytes、bytesarray,不可以是QueryDict。
import json
def index(request):
body=json.loads(request.body)
...