【发布时间】:2016-12-07 18:02:57
【问题描述】:
我在 Flask Python Web 上显示我的 IP 地址时遇到问题。打个比方,如果在PHP编程中很容易就用了
echo $_SERVER['SERVER_ADDR'];
但我不知道如何在 Python Flask Web 中调出 IP 地址。
在 192.168.43.46:4000 上运行的应用程序,而我想显示:
<iframe id="form-iframe" src="http://192.168.43.46/vshell/index.php?type=services&clearcache=true" style="margin:0; width:100%; height:640px; border:none; overflow:hidden;" onload="AdjustIframeHeightOnLoad()"></iframe>
烧瓶中使用的脚本
<iframe id="form-iframe" src="{{ request.script_root }}/vshell/index.php?type=services&clearcache=true" style="margin:0; width:100%; height:640px; border:none; overflow:hidden;" onload="AdjustIframeHeightOnLoad()"></iframe>
并出现在客户端浏览器上:
如何展示:
src="http://192.168.43.46/vshell/index.php?type=services&clearcache=true"
在烧瓶上?
【问题讨论】:
-
使用
{{ request.script_root }}时浏览器看到了什么? -
request.remote_addr -
浏览器见:
{{ request.script_root }}=http://192.168.43.46:4000
标签: python iframe flask jinja2