To allow Python files run in your web site, create a .htaccess file in your public_html directory, and put the following three
lines in it:
AddHandler mod_python .py
This will treat any file ending in .py as a python script and parse your file with Apache mod_python. Some samples are below and the source can be viewed on the server too.