python · 1月 21, 2023 0

How to run the flask application on Port 8001, which is already occupied


The standard port for the Flask application is 5000.So we can access our application.

We may want to change the port is already occupied.We can use the below command to run the Flask application .

if __name__ == ‘__main__’:, port=port_number)
# import flask module
from flask import Flask

# instance of flask application
app = Flask(__name__)

# home route that returns below text
# when root url is accessed
def hello_world():
    return "Hello, World!"

if __name__ == '__main__':, port=8001)

We are running the application of the flask Application on Port 8001.

%d 博主赞过: