1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Utilities
=========
:synopsis: Other utility functions or classes
InternalIPS
-----------
`InternalIPS` allows to specify CIDRs for `INTERNAL_IPS` settings parameter.
Example `settings.py`::
from django_extensions.utils import InternalIPS
INTERNAL_IPS = InternalIPS([
"127.0.0.1",
"172.16.0.0/16",
])
Use `sort_by_size` to sort the lookups to search the largest subnet first.
Example `settings.py`::
from django_extensions.utils.internal_ips import InternalIPS
INTERNAL_IPS = InternalIPS([
"127.0.0.1",
"172.16.0.0/16",
], sort_by_size=True)
`InternalIPS` is inspired by `netaddr.IPSet` please consider using it instead as
it is more optimized but requires the additional `netaddr` package.
|