To run a Python script from a shell, execute the command:
/usr/bin/python /path/to/script.py |
To run a Python script from a web browser first upload a file named .htaccess to your public_html directory with following contents:
Options +ExecCGI AddHandler cgi-script .py |
Then sure your script ends with .psp or .py, upload it to your web site, chmod it to 755, and then access it in a web browser. Below is a simple example script that you can use to test Python functionality.
<html>
<% import time %> Hello world, the time is: <%=time.strftime("%Y-%m-%d, %H:%M:%S")%> </html> |
If you need assistance setting up Python scripts on your web site, please open a ticket through our help desk or send an email to support@hostgosupport.com.