Skip to main content

Simple middleware for filtering requests by their source IP address

Project description

Simple middleware for blocking requests by IP Address


Install Django Middlewall:

pip install django-middlewall

Add it to your INSTALLED_APPS:


Enable middleware components:

# enable both white and black listing


Define access lists in CIDR notation:

# only allow requests from these subnets


# also block this specific address


(optional) Define a custom function to get remote addresses from request objects:

# take advantage of the X_FORWARDED_FOR support in ipware

MIDDLEWALL_ADDRESS_GETTER = 'ipware.ip.get_ip'

Running Tests

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -e .[test]
(myenv) $ pip install tox
(myenv) $ tox


0.1.2 (2017-03-09)

  • General code clean up.

0.1.1 (2017-03-09)

  • First release.

Project details

Download files

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

Source Distribution

django-middlewall-0.1.2.tar.gz (5.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page