如何从本地系统在远程服务器上运行Flask应用程序? [英] How to run a flask app on a remote server from a local system?
问题描述
我可以使用app.run()
在本地系统上运行flask应用程序.但是,当我尝试使用app.run(host='0.0.0.0',port='81')
或app.run(host='<remote ip>')
在远程服务器上运行它时,两者都不起作用.我想知道是否还需要做其他事情.
I'm able to run the flask app on the local system using app.run()
. But when I try to run it on remote server using app.run(host='0.0.0.0',port='81')
or app.run(host='<remote ip>')
,both don't work. I want to know if something else has to be done.
推荐答案
问题不是来自Flask,
The problem is not from Flask,
app.run(host='0.0.0.0')
中指定的IP必须由您的服务器拥有.
The IP specified in app.run(host='0.0.0.0')
must be owned by your server.
如果要在远程服务器上启动Flask,请使用SSH在该服务器上部署代码,然后使用远程会话运行它.
If you want to launch Flask on remote server, deploy the code on that server using SSH and run it using a remote session.
这篇关于如何从本地系统在远程服务器上运行Flask应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!