Skip to content

Instantly share code, notes, and snippets.

@joeypy
Created September 5, 2021 20:11
Show Gist options
  • Save joeypy/625cb1f58a1bd52936992664e607650d to your computer and use it in GitHub Desktop.
Save joeypy/625cb1f58a1bd52936992664e607650d to your computer and use it in GitHub Desktop.
Get the IP address from the client
def my_view(request):
...
...
client_ip = request.META['REMOTE_ADDR']
#or client_ip = request.META['X_FORWARDED_FOR']
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment