I started learning Flask recently and I'm at the early stages.
I googled and these are the links I used to help:
I'm trying to run a simple command like ls -lh /home in Flask when I call http://localhost/ls and show me this output in the web browser:
root@saeed:~# ls -lh /home
total 0
drwxr-xr-x  5 root  root   70 May  8 23:47 git/
drwxr-xr-x  2 root  root   97 May  9 12:07 images/
drwxr-xr-x  3 root  root   20 May 10 04:16 node/
drwxr-xr-x  3 root  root  101 May 11 01:25 python/
drwxr-x---  4 saeed saeed 137 Jan  7 10:48 saeed/
I mean when I enter http://localhost, I see the above output in my internet browser.
I tried different things (you may see the history of this question), but none of them worked and I see a blank white screen in the web browser.
How to do this?
app.py:
from flask import Flask, render_template
import subprocess
app = Flask(__name__)
@app.route('/')
def index():
  # something here to run a simple `pwd` or `ls -l`
templates/index.html:
{% extends 'base.html' %}
# something here to show the output of `pwd` or `ls -l` in the web
 
     
    