ここは私が使ったリンクです(Download files from Amazon S3 with Django)。これを使用して私は1つのファイルをダウンロードすることができます。S3から複数のファイルをダウンロードするdjango
コード:
s3_template_path = queryset.values('file')
filename = 'test.pdf'
conn = boto.connect_s3('<aws access key>', '<aws secret key>')
bucket = conn.get_bucket('your_bucket')
s3_file_path = bucket.get_key(s3_template_path)
response_headers = {
'response-content-type': 'application/force-download',
'response-content-disposition':'attachment;filename="%s"'% filename
}
url = s3_file_path.generate_url(60, 'GET',
response_headers=response_headers,
force_http=True)
return HttpResponseRedirect(url)
私はジッパーが良いだろうと、S3から複数のファイルをダウンロードする必要があります。上記の方法を変更して使用することはできますか?そうでない場合は、他の方法をお勧めします。
は、あなたが探しているファイルごとに同じs3_template_pathであれば、これを変更する場合は必ず? – kujosHeist
いいえ、テンプレートのパスは異なります – Manasa