python flask部署报错?
PHP中文网
PHP中文网 2017-04-18 09:43:18
0
1
357

在使用flask部署在云端的时候,run函数里没有指定host,发现不能访问到。在网上查资料中发现需要指定host="0.0.0.0"才可以在公网访问到。但指定后flaskTemporary failure in name resolution不知如何解决?

请问各位,为什么不指定host的时候公网无法访问,指定后为什么会报这个错,该如何解决?
谢谢大家。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
左手右手慢动作
def run(self, host=None, port=None, debug=None, **options):
    if host is None:
        host = '127.0.0.1'

This is for flask run 函数的源码,host未指定时,会默认赋为'127.0.0.1',而使用回送地址发送数据,协议软件立即返回,不进行任何网络传输。Temporary failure in name resolution, check the dns settings of the resolv.conf file.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!