I already install python 3.7 version. and when I run in command then its works great. But when I try to run http.server 8000 and then browse url then just display my index.py code not a run like web page.
Any idea for this.
I did change in httpd.cong file 1.
AddHandler cgi-script .py
ScriptInterpreterSource Registry-Strict
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm index.py
</IfModule>
also please check my code
#!C:\Users\admin\AppData\Local\Programs\Python\Python37\python.exe
print('sarvesh')
#print(mycursor.rowcount, "record inserted.")
so please let me know.
Did you try to put in cgi-bin folder? Could you test to make sure your installation is all right? Are you using any amp? ( xampp, wamp)
Try this: Create a folder called test. open a command ("cmd.exe") in windows and enter the folder you created. ex " cd c:\test ". Create a cgi-bin folder. ex " mkdir cgi-bin " run python embedded server. " python3 -m http.server --cgi " Put your code in the cgi-bin folder. Access from the browser http://127.0.0.1:8000/cgi-bin/index.py
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.