3

ユーザーごとに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

これを制限する方法はありますか(プレミアムユーザーはフルスピードで、ベーシックユーザーはダウンロードが遅くなります)?

4

1 に答える 1

1

これはサーバーレベルで行う必要があります。必要なものを達成するのに役立つ可能性のあるApacheモジュールがいくつかあります。

http://blog.mansonthomas.com/2009/02/limit-upload-bandwith-of-your-apache.html

http://bwmod.sourceforge.net/

于 2012-06-28T15:02:00.130 に答える