Skip to main content

Simple IP and IP-range blocking for Django

Project description

This is a simple application to restrict access by IP address. There’s a few other apps that do this out there, but they tend to have other features such as rate limiting. I think it’s best to leave rate-limiting to rate-limiting specific apps, so this just blocks IPs.


  • pip install django-block-ip
  • Add block_ip to your INSTALLED_APPS.
  • Add block_ip.middleware.BlockIPMiddleware to your MIDDLEWARE_CLASSES.
  • Run syncdb.
  • Add one or more entries to the BlockIP list in the admin. You can just enter a single IP or use a network mask, like this:


This is based on, which was based on the Justquick’s django snippet (

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-block-ip-0.2.0.tar.gz (3.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page