亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

django多文件下載

django多文件下載

牛魔王的故事 2021-03-17 08:13:57
我的英語不好,因為我來自臺灣,所以我將盡力描述我的問題。我正在使用FileWrapper下載大文件,但我不知道如何在單個響應中下載多個文件。我還能使用什么其他方法?try:    mms = message.objects.get(token=token)except message.DoesNotExist:    return HttpResponse('ret=1&msg=Invalid arguments&')try:    attach = mms.message_attach_set.get(id = int(attach_id))except message_attach.DoesNotExist:    return HttpResponse('ret=1&msg=Invalid arguments&')response = HttpResponse(FileWrapper(attach.file), mimetype='application/force-download')response['Content-Length'] = str(attach.file.size)response['X-Sendfile'] = '%s' % (attach.realName)return response
查看完整描述

1 回答

?
米琪卡哇伊

TA貢獻1998條經驗 獲得超6個贊

一種方法是創建一個tarfile存檔并將文件作為一個包發送。python api在這里


查看完整回答
反對 回復 2021-03-30
  • 1 回答
  • 0 關注
  • 330 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號