import socket hostname = socket.gethostname() ip = socket.gethostbyname(hostname)
from flask import request def get_ip(): ip = request.remote_addr return ip
Python 获取设备ip地址
原文:https://www.cnblogs.com/zhface/p/15267898.html