Solution 1 :

  1. Check the following stack overflow link to get the IP address: How do I get user IP address in django?

  2. The web server(The Django development server/ Nginx/ Apache) will handle the connections to your web application. They will help to send the response back to the same client(same IP) who send the request.
    So you need to write a view function which will return render/HttpResponse/Some other kind of response.


def index(request):
    some_dict = {'ip': '', }
    return render(request, 'polls/index.html', some_dict)
    #return HttpResponse()

Problem :

I am new in the web dev. And have some questions. I hope someone can help me.

when I send a get request from an external device to my django server I do it like that:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)             

s.connect(("" , 8000))    
s.sendall(b'GET / nn')

How can I see an address of a machine which sends a GET request to my web server (everything in the local network)?
How can I send some data back to the same machine after receiving the GET request?

I also would like to be able to send a get request with some message what the device needs so the view in django can proccess it. How can I from the GET request with a additional message?

I use django, server and external devices are connected to the same network

thank you in advance,


Comment posted by user

great thank you 🙂 It works. And for a different GET request for a specific data I can create a separate views in Django.