mirror of
https://github.com/Tencent/Metis.git
synced 2025-12-26 20:34:56 +00:00
12 lines
459 B
Python
12 lines
459 B
Python
import json
|
|
from django.http import HttpResponse
|
|
|
|
|
|
def render_json(dictionary=None):
|
|
dictionary = {} if dictionary is None else 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
|