[Flask] Outputting the results of Python commands to terminal like interface?

Simon Connah scopensource at gmail.com
Wed Oct 9 19:46:30 EDT 2019


I've been thinking of a new website I want to build. It will be my first 
proper Flask website as all my previous websites have used Django. I 
want to use the freedom that Flask has to output the results of 
subprocesses on a website when calling code from the Python subprocess 
module.

I'm somewhat confused about how to do this. I know there are various 
JavaScript terminal emulators around which you can use that allow proper 
command input and output but since all of my commands will be 
pre-written Python scripts it seems to be somewhat overkill.

Should I just take the results of the subprocess commands, save them to 
the database and then on page refresh (either trough F5 or via 
JavaScript) it will show the results of the command(s)?

I could then clean up the output and save it again to the database and 
get rid of most of the superfluous data that isn't needed to store long 
term. Another option since I am using PostgreSQL is to save the data as 
JSON and just leave it like that for future recall.

Any hints and tips on what I should be doing?



More information about the Flask mailing list