Get HOST_ADDR in python without using external resource or webiste

64 Views Asked by At

I'm working on a django project, how can i get my own public ip address without using any external websites, or using python standard library. I tried socket.gethostbyname(socket.gethostname()) which returns 127.0.0.1. As my project is hosted on different servers i want to configure my settings.py settings according to external IP. Any help.??

0

There are 0 best solutions below