I'm using mamp server for testing out all my web pages. I'm new to python. I'm able to run a script in python interpreter that will normally print a hello world.
print "Hello World!"
So i used the same line in a file with name test.py . So how should I run this on web.
As am new to python, i tried some normal things, placing test.py in /htdocs/cgi-bin/ and trying to open it. But it says forbidden page.
Anyone please help me making this work. Thanks
To do this with CGI, I recommend reading the Python CGI docs. At a minimum, you need to output the content type and html tags:
print "Content-Type: text/html"
print
print "<html>"
print "<head>"
print "<title>Example of Python CGI script</title>"
print "</head>"
print "<body>"
print "Hello World!"
print "</body>"
print "</html>"
Also, make sure the web server software has permission to execute the script. You should be able to use chown to set the ownership and chmod to set the permissions.