Could anyone explain how to make python work on this server?
PYTHON
Started by andriy, Feb 11 2011 07:02 AM
3 replies to this topic
#1
Posted 11 February 2011 - 07:02 AM
#2
Posted 11 February 2011 - 08:33 AM
Now it is working.
I put python script into cgi-bin directory.
Here are some tips which I found.
1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
2) The line import cgi must be somewhere at the beginning.
3) The very first print statement of your script must be print "Content-Type: text/html\n"
4) The file permissions must be set to executable (chmod u+x filename).
5) The script should be executed on the command line to check the syntax before looking at it through the browser.
I put python script into cgi-bin directory.
Here are some tips which I found.
1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
2) The line import cgi must be somewhere at the beginning.
3) The very first print statement of your script must be print "Content-Type: text/html\n"
4) The file permissions must be set to executable (chmod u+x filename).
5) The script should be executed on the command line to check the syntax before looking at it through the browser.
#3
Posted 04 April 2011 - 01:02 AM
andriy, on 11 February 2011 - 08:33 AM, said:
Now it is working.
I put python script into cgi-bin directory.
Here are some tips which I found.
1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
2) The line import cgi must be somewhere at the beginning.
3) The very first print statement of your script must be print "Content-Type: text/html\n"
4) The file permissions must be set to executable (chmod u+x filename).
5) The script should be executed on the command line to check the syntax before looking at it through the browser.
I put python script into cgi-bin directory.
Here are some tips which I found.
1) The first line of the script must contain the python command (#!/usr/bin/env python). There must not be a blank line (or anything else) before the first line.
2) The line import cgi must be somewhere at the beginning.
3) The very first print statement of your script must be print "Content-Type: text/html\n"
4) The file permissions must be set to executable (chmod u+x filename).
5) The script should be executed on the command line to check the syntax before looking at it through the browser.
can you give me more tips on the cgi, I still can't get it to work, here's my code:
#!/usr/bin/env/python
import cgi
import cgitb
cgitb.enable()
print "Content-type: text/html\n"
print "<html><head><title>hello</title></head>"
print "<body>HI</body>"
print "</html>"
#4
Posted 08 January 2012 - 01:43 AM
Put it in the cgi-bin?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












