This is a web server configuration problem, not a programming problem.
If you are using Apache, this might work:
chmod 755 myscript.py ln -s myscript.py myscript.cgi
Then put this in your .htaccess file:
AddHandler cgi-script .cgi
If you cannot run the ln command due to lack of access to the shell, just download with the .cgi extension to get started. Or, as icktoofay said, put it in your cgi-bin folder, you also won't need the .htaccess modification.
source share