0

I am trying to capture the IP address of incoming connections to the console using the development webserver that comes with django (manage.py runserver 0.0.0.0:8000). Right now, I get the following output on requests:

[24/Feb/2022 13:03:38] "GET /admin/aqww/ HTTP/1.1" 200 3223

Is there a way to get an incoming client IP address in there? For example, make it look something like the following?

[24/Feb/2022 13:03:38 192.168.1.34] "GET /admin/aqww/ HTTP/1.1" 200 3223
Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
jonesy19
  • 139
  • 1
  • 16

1 Answers1

0

In bad request, you can't get ip as far as i know, since it client error.

But you can get ip with request.META.get("REMOTE_ADDR").

For bad requests you can consider several posts of stack overflow such as:

1 post

2 post

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40