Python scripts can be ran on our servers within your cgi-bin folder. In this article, we'll show you how to setup a basic 'Hello World' python script.

1. The first thing you'll need to do is create hello_world_python.py. Using either the File Manager (of use ftp), create a file named hello_world_python.py. This file should be created in your cgi-bin folder.

python_create_new_file

2. Edit the hello_world_python.py file and input the following code:

#!/usr/bin/env python
print "Content-Type: text/html"
print
print """\
<html>
 <head>
  <title>Python - Hello World</title>
 </head>
 <body>
  Hello World
 </body>
</html>
"""

hello_world_python_code

3. After saving the file, change the permission of hello_world_python.py to 755. Within the File Manager, you can do this by right-clicking on the file and choosing "Change Permissions". Then, set the values to 755.

change_permissions

4. After updating file's permissions, visit yourdomain.com/cgi-bin/hello_world_python.py in your browser. You should see "Hello World" printed to the screen!

hello_word_python

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Help Center:
Email Address
Optional, but our team may contact you for more information.
Did you find this article helpful?

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.