【发布时间】:2020-03-03 20:32:19
【问题描述】:
目前我从我的 Django-Rest 控制器发送一个 zip 文件作为响应,该 zip 文件将在前端下载,此功能工作正常,但现在我想发送一些数据以及 zip 文件回复,有什么办法吗?
这是我的 Django-REST 控制器代码
response = HttpResponse(byte_io.getvalue(),content_type='application/x-zip-compressed')
response['Content-Disposition'] = f'attachment;filename{my-sample-zip-file}'
return response
如何在前端使用此 zip 文件发送一些数据?
【问题讨论】:
标签: django-rest-framework download python-3.6 response django-2.0