Why can't I change the host and port that my Flask app runs on?

前端 未结 5 551
自闭症患者
自闭症患者 2020-11-30 08:32

I want to change the host and port that my app runs on. I set host and port in app.run, but the flask run command still r

5条回答
  •  [愿得一人]
    2020-11-30 08:54

    from flask import Flask
    app = Flask(__name__)
    
    @app.route("/")
    def hello():
        return "Hello World!"
    
    if __name__ == '__main__':
        app.run(host="localhost", port=8000, debug=True)
    

    Configure host and port like this in the script and run it with

    python app.py
    

提交回复
热议问题