Unable to connect to Flask local server

前端 未结 1 1593
一向
一向 2021-01-28 15:14

I\'m trying to build an web app with python and Flask. I started working on it on Ubuntu and it works so far.

However, pulling the project into an windows environment wit

相关标签:
1条回答
  • 2021-01-28 15:51

    http://0.0.0.0 often doesn't work, you will likely need to switch to http://localhost:8080 in your browser.

    Also validate you have set flask to use 0.0.0.0 and not 127.0.0.1.

    I figured I should explain the second part, within a routes.py file you want to make sure you set the host to 0.0.0.0 otherwise you won't be able to access it. So at the bottom of your routes.py make sure you have:

    from flask import Flask
    app = Flask(__name__)
    app.run(host="0.0.0.0")
    
    0 讨论(0)
提交回复
热议问题