How can I add python scripts on my shared web hosting server?

This FAQ will show you how to enable the python libraries on your server, allowing you to run Python scripts

The below instructions will show you what you have to do to enable python scripts on your server, allowing you to run scripts to do a variety of tasks.

To have your python (.py) files parsed by Apache, you will need to add the following handlers to .htaccess.

AddHandler python-program .py
AddHandler cgi-script .py

This will tell Apache to handle the extension using Python.

You should also add the following Interpreter paths to your .py file:

/usr/bin/python
/usr/bin/python2.6

Please make sure that the file has proper execution rights by setting its permissions to 755. This can be done by running the following command via SSH/FTP client:

chmod 755 file.py

You can also do this by using the file manager in your control panel.