noinot
noinot

Reputation: 49

Flask App Refusing Connections

I am running my flask app with the line: app.run(host='0.0.0.0', debug=True, threaded=True, port=5000, passthrough_errors=False)

but when I go to localhost:5000 it get a ERR_CONNECTION_REFUSED error. Any thoughts on what's happening? Out when runnning is:

 * 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 code:

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)

Upvotes: 1

Views: 2536

Answers (1)

noinot
noinot

Reputation: 49

It was running inside a docker container, I didn't have the port in the docker run command. Make sure inside the docker run command you have -p 80:80 (replace 80 with the port you want to run on)

Upvotes: 1

Related Questions