如何更改前夕的IP地址? [英] How to change eve's IP address?
问题描述
当我运行 api.py
时,默认IP地址为 127.0.0.1:5000
,它是本地主机.我在服务器端运行eve脚本.我可以将该IP地址更改为服务器的地址吗?还是我只是使用服务器的地址访问它.
When I run the api.py
the default IP address is 127.0.0.1:5000
which is the local host. I am running the eve scripts on the server side. Am I able to change that IP address to server's address? or Am I just access it using server's address.
例如,如果服务器的地址是 11.5.254.12
,则运行 api.py
.我是否可以使用 11.5.254.12:5000
在服务器外部访问它,还是可以将其从 127.0.0.1
更改为 11.5.254.12
?
For example,
if the server's address is 11.5.254.12
, then I run the api.py
.
Am I able to access it outside of the server using 11.5.254.12:5000
or is there any way to change it from 127.0.0.1
to 11.5.254.12
?
推荐答案
向您的 app.run()
添加参数.默认情况下,它在本地主机上运行,将其更改为 app.run(host ='0.0.0.0')
以在您的计算机IP地址上运行.
Add a parameter to your app.run()
. By default it runs on localhost, change it to app.run(host= '0.0.0.0')
to run on your machine IP address.
这篇关于如何更改前夕的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!