Python program to serve the output of a command via HTTP
<p>I wonder if anyone can help me web enhance a python script which runs a status command for various apps:</p>

<pre><code>/app/app1/bin/status.sh
/app/app2/bin/status.sh
</code></pre>

<p>A check() function in the script creates a hash:</p>

<pre><code>results = check_function()

results['app1']['status'] = 'running'
results['app2']['status'] = 'stopped'
</code></pre>

<p>My current solution is terminal only and a display_results() function prints the status of the environment  to the terminal with appropriate escape sequences to colorize it:</p>

<pre><code>display_results(results)
</code></pre>

<p>I'd like to "web enable" the command so that it can have report the results dictionary over the web.</p>

<p>I'm thinking I can just have it listen on a socket and write HTML through a string template or would it be better to have BaseHTTPServer do the listening but how to get it to serve the output of a command rather than the index.html file on a filesystem?</p>

<p>This is not a production application it's used as a tool for developers to do a mass check on the status of an app.</p>

<p>The terminal version works with python 2.4 (Centos 5.8) but there's nothing to stop me from using python 2.7</p>

<p>Any suggestions?</p>
