如何在Python / Django中获取当前的用户IP
我正在尝试在登录过程中捕获当前登录用户的IP地址和系统名称。 我使用以下代码来使用以下代码:
import socket
system = socket.gethostname()
IPAddr = socket.gethostbyname(system)
它在本地服务器中正常工作,但是当我推到服务器时,它将以服务器名称和服务器IP代替用户IP。
I am trying to capture the IP Address and the System Name of the current Login user during the login Process.
I Use following code for the same:
import socket
system = socket.gethostname()
IPAddr = socket.gethostbyname(system)
It works fine in Local Server but when I push to Server it takes the server name and server IP instead of user IP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论