title: Getting python scripts to run in http simple server
body: <p>I have a simple python script that I want to serve as a website:</p>
  
  <pre><code>import SimpleHTTPServer
  import SocketServer
  
  PORT = 8000
  
  Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
  
  httpd = SocketServer.TCPServer(("", PORT), Handler)
  
  print "serving at port", PORT
  httpd.serve_forever()
  </code></pre>
  
  <p>I'm in that folder and run</p>
  
  <pre><code>$ python3 -m http.server 
  </code></pre>
  
  <p>then I visit
  <a href="http://hassbian.local:8000/song.py" rel="nofollow noreferrer">http://hassbian.local:8000/song.py</a></p>
  
  <p>The terminal says this and I get the file as a txt file, the script won't execute.</p>
  
  <pre><code>Serving HTTP on 0.0.0.0 port 8000 ...
  192.168.1.115 - - [04/Jun/2017 14:19:59] "GET / HTTP/1.1" 200 -
  192.168.1.115 - - [04/Jun/2017 14:20:04] "GET /song.py HTTP/1.1" 200 -
  </code></pre>
  
  <p>Running on a rasberry pi</p>