Login

Snippets by pill

Snippet List

Block IP addresses

I needed a quick and dirty way to block a user from my site. Just include this middleware class under the 'MIDDLEWARE_CLASSES' variable in your settings.py file. Also include the variable BLOCKED_IPS = ('123.123.123.123',) variable, where the value is a tuple of IP addresses you want blocked from your site.

  • middleware
  • ip-address
Read More

pill has posted 1 snippet.