web applications - Making Python scripts work on MAMP -


i'm using mamp server testing out web pages. i'm new python. i'm able run script in python interpreter print hello world.

print "hello world!"    

so used same line in file name test.py . how should run on web.

as new python, tried normal things, placing test.py in /htdocs/cgi-bin/ , trying open it. says forbidden page.

anyone please me making work. thanks

to cgi, recommend reading python cgi docs. @ minimum, need output content type , 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 web server software has permission execute script. should able use chown set ownership , chmod set permissions.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -