resp = HttpResponse(s.getvalue(), mimetype='application/x-zip-compressed')
resp['Content-Disposition'] = 'attachment; filename=%s' % zip_filename
return resp
Serving dynamically generated ZIP archives in Django