This middleware allows you to mark Django URL namespaces as unavailable to all requests except those coming from a whitelisted IP subnet.
Project description
django-simple-ip-restrict
This middleware allows you to mark Django URL namespaces as unavailable to all requests except those coming from a whitelisted IP subnet.
Instructions
Add to the list of MIDDLEWARE:
"django_simple_ip_restrict.middleware.ip_filter",
Then you can set the following keys on settings.py:
- IP_PROTECTED_NAMESPACES: list of namespaces to block (default: ["admin"])
- IP_NETWORKS_WHITELIST: list of subnets to allow, in CIDR notation
Creating a new release
Update the version in pyproject.toml and create a new tag with that version number and push it, this will trigger the release.yml GitHub Action.
git push origin <tag_name>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_simple_ip_restrict-1.0.42.tar.gz
.
File metadata
- Download URL: django_simple_ip_restrict-1.0.42.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1036-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 645594c001f18db5c3966385f1cfaee22ed55b3c712231e7c9fc4bc51fa1e63e |
|
MD5 | e0487284669d8c0bf7f7f4e2fc0647ca |
|
BLAKE2b-256 | 4aa5bd147e4ed902e71e4c2a94a4858102a16ff3d0a070bf184ba02213e926d4 |
File details
Details for the file django_simple_ip_restrict-1.0.42-py3-none-any.whl
.
File metadata
- Download URL: django_simple_ip_restrict-1.0.42-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1036-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49fc32d8a48f66951eb6a58bd419bbfdcb71b58c7175dc2f33656711c2104c95 |
|
MD5 | d5cf13b1cd1c45bfec99db9eeb304b2f |
|
BLAKE2b-256 | 9777070ed5c65a3f2442ae7b92abd03991fd4be8a852fd2fa0f2c0c17a3669cf |