python multiple flask on one server

  1. Import necessary modules:
from flask import Flask
  1. Create Flask instances for each application:
app1 = Flask(__name__)
app2 = Flask(__name__)
  1. Define routes for each application:
def app1_route():
    return 'Hello from App 1'

def app2_route():
    return 'Hello from App 2'
  1. Run each application with different port numbers:
if __name__ == '__main__':
  1. Save the script with a filename (e.g., and run it in the terminal:
  1. Access each application in a web browser using the specified port numbers:
  2. App 1: http://localhost:5000/app1
  3. App 2: http://localhost:5001/app2