最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]Flask运行出错:socket.gaierror Errno -2 Name or service not known

Flask crifan 2163浏览 0评论

折腾:

[已解决]运行Flask出错:socket.error Errno 98 Address already in use

之后,运行Flask,又出现其它错误:

(SIPEvents)  SIPEvents flask run –host=0.0.0. –port=8080
 * Serving Flask app “app”
 * Forcing debug mode on
Traceback (most recent call last):
  File “/root/Envs/SIPEvents/bin/flask”, line 11, in <module>
    sys.exit(main())
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/cli.py”, line 478, in main
    cli.main(args=args, prog_name=name)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/cli.py”, line 345, in main
    return AppGroup.main(self, *args, **kwargs)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/decorators.py”, line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/flask/cli.py”, line 403, in run_command
    use_debugger=debugger, threaded=with_threads)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/werkzeug/serving.py”, line 677, in run_simple
    s.bind((hostname, port))
  File “/usr/local/lib/python2.7/socket.py”, line 228, in meth
    return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known

flask socket.gaierror: [Errno -2] Name or service not known

flask socket.gaierror Errno -2 Name or service not known

退出SSH2连的CentOS服务器。

再进入试试。

果然就可以了:

(SIPEvents)  SIPEvents export FLASK_APP=app.py
(SIPEvents)  SIPEvents export FLASK_DEBUG=1
(SIPEvents)  SIPEvents flask run –host=0.0.0.0 –port=8080
 * Serving Flask app “app”
 * Forcing debug mode on
 * Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger pin code: 353-795-063

转载请注明:在路上 » [已解决]Flask运行出错:socket.gaierror Errno -2 Name or service not known

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
72 queries in 0.109 seconds, using 18.98MB memory