对于大文件(> 5MB),使用HttpResponse下载错误,因为“主体大小太长”,导致下载错误]] << [

问题描述 投票:2回答:1
我正在从s3存储桶中检索文件,并将内容作为文件返回,如下所示:

s3 = boto3.resource("s3") object = s3.Object(bucket-name,s3_key) text = object.get()['Body'] response = FileResponse(text) response['Content-Disposition'] = 'attachment;filename=sample.xls' return response

但是返回文件时出现"body size is too long"错误。 

我正在从s3存储桶中检索文件,并将内容作为文件返回,如下所示:s3 = boto3.resource(“ s3”)object = s3.Object(bucket-name,s3_key)text = object.get()['正文'] ...

django python-3.x file amazon-s3 download
1个回答
0
投票
尝试:
© www.soinside.com 2019 - 2024. All rights reserved.