mirror of
https://github.com/Tencent/Metis.git
synced 2025-12-26 12:22:46 +00:00
10 lines
398 B
Python
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 |