I'm a LAMP developer trying out Python for the first time.. I'm okay with picking up the syntax, but I can't figure out how to run it on the server! I've tried the following

uploading filename.py to a regular web/public directory. chmod 777, 711, 733, 773... (variations of execute)
putting the filename.py in cgi-bin, chmod same as above..

Typing up example.com/filename.py simply loads a textfile - nothing appears to have been compiled/parsed/etc!
(I believe python is installed, as 
whereis python on my server shows  /usr/bin/python  among several other directories)
Many words for a simple question - how do you run a python file on a CentOS server?
you can use cgi, but that will not have great performance as it starts a new process for each request.
More efficient alternatives are to use fastcgi or wsgi
A third option is to run a mini Python webserver and proxy the requests from apache using rewrite rules
Running a .py file on LAMP (CentOS) server - from a PHP developer's perspective