Flask - Run Flask on a specific port
by
Jeremy Canfield |
Updated: April 12 2023
| Flask articles
By default, a Flask app will run on port 5000. There are quite a few different ways to run your Flask app on some other port.
For example, let's say you are using the flask run command to run your Flask app. The --port option can be used to specify the port you want to use.
~]$ flask run --port 12345
Or, you could use the port option in your main.py file.
from website import my_website
app = my_website()
if __name__ == '__main__':
app.run(host="10.17.5.125", port="12345")
Did you find this article helpful?
If so, consider buying me a coffee over at