Legacy


  1. Home
  2. Support
  3. Legacy
  4. Scripting
  5. How to run Python CGI
Click here for full details

How to run Python CGI

On Linux accounts, our Python executable is located at /usr/bin/python. Make sure to specify this in your shebang at the top of your Python script as #!/usr/bin/python.

How to Configure Python

1. First navigate to your domains web service settings through the hosting control panel.

2. Select Add CGI Alias

3. Enter the extension for Python, .py.

4. Click Submit and you should be good to go. Make sure you’ve given the file executable permissions before trying to execute the script.

Here is an example Python script you can use to test whether your configuration works or not:

#!/usr/bin/python

import cgi

import cgitb; cgitb.enable()


print "Content-type: text/html\n"

print("<TITLE>CGI script output"</TITLE">

print("<H1> This is a CGI script </H1>")

print("Hello, world!") 
Click here for full details

Classification: Public
Last saved: 2021/11/11 at 14:23 by Jamie