简体   繁体   中英

how to call a python program from html

I have a form in html with action = "pyth.py"

and pyth.py is

#!/usr/bin/python
print('Content-type: text/html\r\n\r')
print('<html><head></head><body>My first page</body></html>')

so when i click submit in form it should run the pyth.py and should give me an html output. but it is not. please help me

You have to run the python script in cgi-bin of your webserver. Your html form action should be action="/cgi-bin/pyth.py" . Check out this tutorial .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM