I have just been introduced to the Django framework and I would like to use this framework for a lot of my system based Perl/Python/wlst scripts for my group. How can I take the normal command line output and have it output the browser in near real time? I have looked into serialization but I can't seem to find any good tutorials. I am just looking for suggestions on how to make a normal Python/Perl script and make it work with a Django based web site.
Specifically: I have a script that will add a user to a group to a role for a weblogic domain. I want to make it so that you fill in the form, it connects to the server does the work and returns the output. The only thing is that it can take a little bit for it to connect.
You want do siplay external script results in the web browser? Then, I suggest you make those scripts write their results to database and then use django models to fetch and display the info.
If you want to execute the script each time user opens the webpage and display a result, use this python code:
def command_output(cmd):
""" Capture a command's standard output."""
import subprocess;
return subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate()[0];
result = command_output('ls -al');