Login

Tag "internal_ips"

Snippet List

Internal view decorator

The `internal_view` decorator makes a view accessible only from `INTERNAL_IPS`. Handy for exposing internal APIs.

  • view
  • decorator
  • internal_ips
Read More

Support IP ranges in INTERNAL_IPS

CIDR ( http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing ) is a well-known IP range syntax. This CIDR_LIST class can be used to make ranges of IPs considered "internal" for Django's debugging and security purposes. (Django only ever needs to do "ip in INTERNAL_IPS" so __contains__ is sufficient for the purpose.) For example, to make localhost and the entire block of 10.0.0.* considered to be internal, use: INTERNAL_IPS = CIDR_LIST([ '127.0.0.1', '10.0.0.0/24' ])

  • debugging
  • security
  • ip
  • cidr
  • internal_ips
Read More

2 snippets posted so far.