Python 烧瓶应用程序拒绝连接
我正在使用以下行运行我的flask应用程序: 运行(host='0.0.0.0',debug=True,threaded=True,port=5000,passthrough\u errors=False) 但是,当我转到localhost:5000时,它会得到一个ERR\u CONNECTION\u densed错误。对发生的事情有什么想法吗? 运行时的输出为:Python 烧瓶应用程序拒绝连接,python,flask,connection,Python,Flask,Connection,我正在使用以下行运行我的flask应用程序: 运行(host='0.0.0.0',debug=True,threaded=True,port=5000,passthrough\u errors=False) 但是,当我转到localhost:5000时,它会得到一个ERR\u CONNECTION\u densed错误。对发生的事情有什么想法吗? 运行时的输出为: * Debug mode: on * Running on http://0.0.0.0:5000/ (Press CTRL+C
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 183-524-396
main.py代码:
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)
它在docker容器中运行,docker run命令中没有端口。确保在docker run命令中有-p 80:80(将80替换为要运行的端口)此应用程序中是否有端点?请将flask应用程序缩减为演示问题的最短程序。(一个“hello world”烧瓶应用程序可以短至20行)。将该应用程序复制粘贴到您的问题中。我会,但它们会抛出错误。我正在开发一个简单的应用程序来测试错误跟踪器。我现在得到一个ERR\u EMPTY\u响应