有没有办法在每个用户的基础上限制django中文件下载的速度? 我见过如下例子:
filename = __file__ # Select your file here.
wrapper = FileWrapper(file(filename))
response = HttpResponse(wrapper, content_type='text/plain')
response['Content-Length'] = os.path.getsize(filename)
return response
有没有办法限制这一点(说高级用户获得全速,基本用户下载速度较慢)?
答案 0 :(得分:1)
您应该在服务器级别执行此操作。有几个apache模块可以帮助你实现你想要的东西。
http://blog.mansonthomas.com/2009/02/limit-upload-bandwith-of-your-apache.html