我的英語(yǔ)不好,因?yàn)槲襾?lái)自臺(tái)灣,所以我將盡力描述我的問(wèn)題。我正在使用FileWrapper下載大文件,但我不知道如何在單個(gè)響應(yīng)中下載多個(gè)文件。我還能使用什么其他方法?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貢獻(xiàn)1998條經(jīng)驗(yàn) 獲得超6個(gè)贊
一種方法是創(chuàng)建一個(gè)tarfile
存檔并將文件作為一個(gè)包發(fā)送。python api在這里
添加回答
舉報(bào)
0/150
提交
取消