1๐
I think the way you are returning the response to your view is causing the trouble.
Try something like this โ
import json
from django.http import HttpResponse, JsonResponse
def sign_s3(request):
#Your View Code Here...
#Finally The Response (Using JsonResponse)...
json_object = {
'data': presigned_post,
'url': 'https://%s.s3.amazonaws.com/%s' % (S3_BUCKET, file_name)
}
return JsonResponse(json_object)
#Another Response Option (Using HttpResponse)
data = {
'data': presigned_post,
'url': 'https://%s.s3.amazonaws.com/%s' % (S3_BUCKET, file_name)
}
return HttpResponse(json.dumps(data), content_type = "application/json")
๐คUtkarsh Sinha
Source:stackexchange.com