context_processors.py 291 Bytes
Newer Older
fred's avatar
fred committed
1 2 3
from django.conf import settings

def internal_ip(request):
4 5 6
    internal_ip = request.META.get('HTTP_X_FORWARDED_FOR') or \
               request.META.get('HTTP_X_REAL_IP') or \
               request.META.get('REMOTE_ADDR')
7
    return {'internal_ip': internal_ip in settings.INTERNAL_IPS}