PDA

View Full Version : How to deploy Python script?



Dimedrol
04-15-2009, 03:42 AM
Hello!
I want to start using Python on my Bluehost's website.

I've got simple "hello world" script:



#!/usr/bin/python

print "Hello, World!"


So...
Does this path to python is right?
And where to upload this script to? (cgi-bin?)
How to start this script (go to url?)
Script rights? (777 or what?)

In general - how to start using it? :)

Treeluvin
04-16-2009, 02:58 AM
Yes, the path to Python is correct.
Bluehost allows CGI scripts to be executed from any directory, so anywhere inside your ~/public_html/ directory is fine.
Yes, just visit the URL.
You'll want all CGI scripts to be set to at least 700 (755 being the most common, though).

Something you'll need to add to this script is the header information if you want any output displayed (otherwise you'll get some 500 error):



#!/usr/bin/python

print "Content-type: text/html\r\n\r\n";
print "Hello, World!";