Search code examples
pythonflaskportprogressive-web-apps

where to define port for Flask


I have cloned this repo in my Windows system for Flask-PWA app https://github.com/umluizlima/flask-pwa

After running the repo as per README instructions, I am facing the problem that it is loading flask app on http://127.0.0.1:5000/ . On this link it shows up an older Flask app that I had made. How can I flush this 5000 port or add a custom port? Or is there another way to solve this problem?


Solution

  • Port can be specified in the parameters of the run function of the app. For instance:

    from flask import Flask
    
    app = Flask(__name__)
    ...
    host = '0.0.0.0'
    port = 5001
    app.run(host=host, port=port)