Metis/app/controller/common/render.py
dongdonglin(林向东) ee5235c6fe feat(local): commit code
2018-10-12 17:14:54 +08:00

10 lines
398 B
Python

import json
from django.http import HttpResponse
def render_json(dictionary={}):
response = HttpResponse(json.dumps(dictionary), content_type="application/json")
response['Access-Control-Allow-Origin'] = '*'
response["Access-Control-Allow-Headers"] = "Origin, X-Requested-With, Content-Type"
response["Access-Control-Allow-Methods"] = "GET, POST, PUT, OPTIONS"
return response