折腾:
期间,对于app是:
(SIPEvents) SIPEvents cat app.py from flask import Flask app = Flask(__name__) @app.route(“/”) def hello(): return “Hello World!” if __name__ == “__main__”: app.run(host=’0.0.0.0′, port=8080) |
运行出错:
(SIPEvents) SIPEvents flask run –host=0.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.error: [Errno 98] Address already in use |
感觉是:
此处uwsgi占用了端口?
所以无法使用。
然后就可以解决此问题了。
不过又出现其它问题:
[已解决]Flask运行出错:socket.gaierror Errno -2 Name or service not known
转载请注明:在路上 » [已解决]运行Flask出错:socket.error Errno 98 Address already in use