如何从 web2py 应用程序(例如控制器或模块)内部获取服务器(部署 web2py 应用程序)上的端口号?
我正在使用 urllib 通过执行此操作与控制器内的另一个操作进行交互
response = urllib2.urlopen('http://127.0.0.1:8000%s?%s'%(URL('unregister_relationship.json'),urllib.urlencode(data)))
response = json.loads(response.read())
但这需要事先知道端口号,我希望它是动态的。