django 实现下载功能

from django.http import FileResponse
def download(request):
    if.....
        file=open([path],'rb')
        response=FileResponse(file)
        response['Content-Type'] = 'application/octet-stream'
        response['Content-Disposition'] = 'attachment;filename="[filename].xls"'
  return response
posted @   月河  阅读(102)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示