title: How do you execute a server-side python script using http.server?
body: <p>I have a collection of python scripts, that I would like to be able to execute with a button press, from a web browser.</p>
  
  <p>Currently, I run <code>python -m http.server 8000</code> to start a server on port 8000. It serves up html pages well, but that's about all it does. Is it possible to have it execute a python script (via ajax) and return the output, instead of just returning the full text of the .py file.</p>
  
  <p>Additionally, if not, is there a simple (as in only 1 or 2 files) way to make this work? I'm looking for the equivalent of PHP -s, but for python.</p>
  
  <p>For completeness, this is my html</p>
  
  <pre><code>&lt;h1&gt;Hello World&lt;/h1&gt;
  
  &lt;button&gt;
  Click me!
  &lt;/button&gt;
  
  &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.js"&gt;    &lt;/script&gt;
  
  &lt;script&gt;
    $('button').click(function(){
      $.get('/gui/run_bash.py');
    });
  &lt;/script&gt;
  </code></pre>