关于python:Flask App Refusing Connections | 珊瑚贝

Flask App Refusing Connections


我正在运行我的Flask应用程序:
app.run(host=’0.0.0.0′, debug=True, threaded=True, port=5000, passthrough_errors=False)

但是当我转到 localhost:5000 时,它会收到 ERR_CONNECTION_REFUSED 错误。对正在发生的事情有任何想法吗?
运行时输出为:

1
2
3
4
5
 * Debug mode: on
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 183524396

main.py 代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from flask import Flask
from flask_cors import CORS
from test_1.test1 import test1
from test_1.test_files.error_handler import handle_error
# import rollbar

app = Flask(__name__)

@app.route(“/”)
def hello():
    return“Hello From Error Reporting Test!”

@app.errorhandler(Exception)
def error_handler(error):
    return handle_error(error)

app.register_blueprint(test1, url_prefix=‘/test1’)
cors = CORS(app, resources={r“/test1/*”: {“origins”:“*”}},
            headers={‘Access-Control-Request-Headers’, ‘Content-Type’, ‘Access-Control-Allow-Origin’})

if __name__ == ‘__main__’:
    app.run(host=‘0.0.0.0’, debug=True, threaded=True, port=5000, passthrough_errors=False)

  • 您在此应用程序中有任何端点吗?
  • 请将您的Flask应用程序减少到可以证明问题的最短程序。 (一个”hello world”Flask应用程序可以短至 20 行)。将该应用程序复制粘贴到您的问题中。
  • 我有,但它们是为了抛出错误而编写的。我正在构建一个简单的应用程序来测试错误跟踪器。
  • 我现在收到 ERR_EMPTY_RESPONSE


它在 docker 容器中运行,我在 docker run 命令中没有端口。确保在 docker run 命令中有 -p 80:80 (将 80 替换为要运行的端口)


来源:https://www.codenong.com/50825826/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_9204.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?