0

I am attempting to run a basic python flask app on my localhost.

I ran the following code:

app = Flask(__name__)

@app.route('/')
def start():
    return "starting the app"

if __name__ == '__main__':
    app.run(debug=True)       

I get the following message:


Serving Flask app "app" (lazy loading)
Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
Debug mode: on
Restarting with stat
Debugger is active!
Debugger PIN: 
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)*

I get a ERR_CONNECTION_REFUSED / localhost refused to connect message when I try to load the page.

I have tried loading the url in multiple browsers, and I have tried turning off my firewall (windows defender).

I have also tried

    app.run(debug=True, host = '0.0.0.0')       

then running with my IP address.

Can anyone recommend anything else to try? Thanks.

  • Does this answer your question? [Flask at first run: Do not use the development server in a production environment](https://stackoverflow.com/questions/51025893/flask-at-first-run-do-not-use-the-development-server-in-a-production-environmen) – mhhabib Apr 13 '21 at 08:12
  • Thanks, unfortunately none of these suggestions worked in my case. – Jonathan Sainsbury Apr 13 '21 at 13:47

0 Answers0