我正在运行我的烧瓶应用程序: app.run(host =' 0.0.0.0',debug = True,threaded = True,port = 5000,passthrough_errors = False)
但是当我转到localhost:5000时会出现ERR_CONNECTION_REFUSED错误。对于发生了什么事的任何想法? 在跑步时出局:
* 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)
答案 0 :(得分:0)
它在docker容器内运行,我在docker run命令中没有端口。确保在docker run命令中你有-p 80:80(用你要运行的端口替换80)