1def get_client_ip(request):
2 x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
3 if x_forwarded_for:
4 ip = x_forwarded_for.split(',')[0]
5 else:
6 ip = request.META.get('REMOTE_ADDR')
7 return ip
1def visitor_ip_address(request):
2
3 x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
4
5 if x_forwarded_for:
6 ip = x_forwarded_for.split(',')[0]
7 else:
8 ip = request.META.get('REMOTE_ADDR')
9 return ip
10