Django:HTTPレスポンスでファイルを返す
実装例
from django.http import FileResponse
from django.views.generic.base import View
class FileResponseView(View):
def get(self, request, *args, **kwargs):
response = FileResponse(open('送信するファイルのパス', 'rb'))
response['content_type'] = 'application/zip'
response['Content-Disposition'] = 'attachment; filename=ファイル名'
return response