If you use command: flask run to start http server, it's not OK to add host and port information under run function, like below:
if __name__== '__main__':
app.run(
host = '0.0.0.0',
port = 7777,
debug = True
)
but it's ok to use python flaskXXX.py to start the http server.
Using flask, the HOST and PORT infor is covered by flask command options.
Chang it by option -h and -p.
Example: falsk run -h 0.0.0.0 -p 7777
本文介绍了使用Flask框架启动HTTP服务器时如何正确设置主机和端口信息。文章指出,在使用flask run命令启动服务器时,不应直接在app.run()函数中指定host和port参数,而应当通过命令行选项进行配置。
1348

被折叠的 条评论
为什么被折叠?



