Skip to content

need docs for how to create a middleware to prevent , hard codding for a rate limit for all views in a project #328

@erfansafarali2005

Description

@erfansafarali2005

the middleware documentation needs to clarfiy how to create a middleware to apply a rate limit to all of the views in a project

    @method_decorator(ratelimit(key='ip' , rate='3/s' , block=True)) 
    @method_decorator(ratelimit(key='ip' , rate='30/m' , block=True)) 
    def dispatch(self, request, *args, **kwargs):
        return super().dispatch(request,*args , **kwargs)

i want all of my views to have these rate limits applied on them . without hard codding and repeating it on everyone of my views

thx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions