Python - How to run multiple flask apps from same client machine

Flask development server by default listens on port 5000 so when you run a Flask app without port number it will run on 5000.

You can run a number of Flask app on the same machine but with the different port numbers. Let's say your scripts names are script1.py and script2.py:

$ export FLASK_APP=script1.py
$ flask run --host 0.0.0.0 --port 5000

Open up a new terminal

$ export FLASK_APP=script2.py
$ flask run --host 0.0.0.0 --port 5001

Although other answer suggests to run both flask servers with different --port arguments, I wanted to share another issue to consider:

Clear the browser cache

Did you clear cache memory before running the second script?

There are times when browser has previous data of the URL (including first port) still stored. So it will display old data (from first script and port) instead of fetching new data (from second script and port).

You can clear the cache memory and then run the second script, access in browser and see it fetches the data correctly from the second app's URL.