Limit number of views per day in Django

Posted by ariddell on Stack Overflow See other posts from Stack Overflow or by ariddell
Published on 2010-03-04T00:27:35Z Indexed on 2010/03/21 19:41 UTC
Read the original article Hit count: 253

Filed under:

Is there an easy way to limit the number of times a view can be accessed by a given IP address per day/week? A simplified version of the technique used by some booksellers to limit the number of pages of a book you can preview?

There's only one view that this limit need apply to--i.e. it's not a general limit--and it would be nice if I could just have a variable overlimit in the template context. The solution need not be terribly robust, but limiting by IP address seemed like a better idea than using a cookie.

I've looked into the session middleware but it doesn't make any references to tracking IP addresses as far as I can tell.

Has anyone encountered this problem?

© Stack Overflow or respective owner

Related posts about django