0

I have created web application. I need to get the IP address of the clients who are accessing my website and need to count the ip address for to find out how many users view this site. Can anyone give some ideas for to do this concepts. Then I referred some idea like:

x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')

Here HTTP_X_FORWARDED_FOR referred by?

Thanks in advance.

sankar
  • 83
  • 4
  • 16

2 Answers2

1

The simplest way is with:

request.META.get('REMOTE_ADDR')

If your app server is behind a proxy, see this more advanced solution (using the HTTP_X_FORWARDED_FOR you mentioned):

Community
  • 1
  • 1
dkamins
  • 21,450
  • 7
  • 55
  • 59
0

You should have to use django-ipware for get correct IP. This django app will give you 99% correct result. I am using this app and i am always getting correct result.

Note: I have given 99% success rating a per my previous working experience.

Yogesh dwivedi Geitpl
  • 4,252
  • 2
  • 20
  • 34