I have a util method in Python Django project:
def getUserInfo(request):
user = request.user
user_dict = model_to_dict(user)
user_dict.pop("password")
user_dict.pop("is_superuser")
user_dict["head_img"] = user.head_img.url # there is `/media/images/users/head_img/blob_NOawLs1`
I want to add my server domain or ip in the front of it, like:
http://www.example.com:8000/media/images/users/head_img/blob_NOawLs1
How to get current server ip( or domain )?
EDIT
I am not going to get the remote ip, I just want to get the server ip. I mean, I write the Django as backend server, when it is running, how can I get the server ip? or domain.