context_processors.py 289 Bytes
Newer Older
fred's avatar
fred committed
1 2 3 4 5 6 7
from django.conf import settings

def internal_ip(request):
    internal_ip = self.request.META.get('HTTP_X_FORWARDED_FOR') or \
               self.request.META.get('HTTP_X_REAL_IP') or \
               self.request.META.get('REMOTE_ADDR')
    return internal_ip in settings.INTERNAL_IPS