在django里如何设置响应头的头信息
1.将响应信息转化为json格式,使用response = json.dumps(response)或者response = JsonResponse(respnse)
2.设置响应头
response["Access-Control-Allow-Origin"] = "http://192.168.10.101:8080"
response["Access-Control-Allow-Credentials"] = "true"
response["Access-Control-Allow-Methods"] = "GET,POST"
response["Access-Control-Allow-Headers"] = "Origin,Content-Type,Cookie,Accept,Token"
reutrn response