问题
I'd like to log the IP addresses of machines that access my web.py application. How can I access this data within the web.py framework? I'm happy to send the address to my own logger.
回答1:
Use web.ctx['ip']
to get the remote ip address. Here is a link which explains what's in the context.
来源:https://stackoverflow.com/questions/5347484/log-incoming-ip-addresses-in-web-py