Python Flask: Get subprocess output on front end using Ajax

Viewed 48

I am running subprocess command at backend and I want to get that output to frontend.

Ex:

import subprocess
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
    subprocess.run(['pip', 'install', 'requirements.txt'])
    return "Hello"
app.run()

I would like to get live output on front end lets say in text-area using flask framework.

Is there any way to do this?

0 Answers
Related