title: How to execute python script on the BaseHTTPSERVER created by python?
body: <p>I have simply created a python server with :</p>
  
  <pre><code>python -m SimpleHTTPServer
  </code></pre>
  
  <p>I had a .htaccess (I don't know if it is usefull with python server)
  with:</p>
  
  <pre><code>AddHandler cgi-script .py
  Options +ExecCGI
  </code></pre>
  
  <p>Now I am writing a simple python script :</p>
  
  <pre><code>#!/usr/bin/python
  import cgitb
  cgitb.enable()
  print 'Content-type: text/html'
  print '''
  &lt;html&gt;
       &lt;head&gt;
            &lt;title&gt;My website&lt;/title&gt;
       &lt;/head&gt;
       &lt;body&gt;
            &lt;p&gt;Here I am&lt;/p&gt;
       &lt;/body&gt;
  &lt;/html&gt;
  '''
  </code></pre>
  
  <p>I make test.py (name of my script) an executed file with:</p>
  
  <pre><code>chmod +x test.py
  </code></pre>
  
  <p>I am launching in firefox with this addres: (http : //) 0.0.0.0:8000/test.py</p>
  
  <p>Problem, the script is not executed... I see the code in the web page...
  And server error is:</p>
  
  <pre><code>localhost - - [25/Oct/2012 10:47:12] "GET / HTTP/1.1" 200 -
  localhost - - [25/Oct/2012 10:47:13] code 404, message File not found
  localhost - - [25/Oct/2012 10:47:13] "GET /favicon.ico HTTP/1.1" 404 -
  </code></pre>
  
  <p>How can I manage the execution of python code simply? Is it possible to write in a python server to execute the python script like with something like that:</p>
  
  <pre><code>import BaseHTTPServer
  import CGIHTTPServer
  httpd = BaseHTTPServer.HTTPServer(\
      ('localhost', 8123), \
  CGIHTTPServer.CGIHTTPRequestHandler)
  ###  here some code to say, hey please execute python script on the webserver... ;-)
  httpd.serve_forever()
  </code></pre>
  
  <p>Or something else...</p>