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

This article will show you how to enable the Python libraries on your server

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. To find out more about .htaccess files, please read the following guide: How do I password protect my site? (.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:


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

You can also do this by using the File Manager in your Control Panel.