Web server programming environment setup(windows)
Python3.x built-in cgi-server is strongly recommanded
I use Python 3.8.1
1. At first, make a directory somewhere named 'www', where you should make one more directory named 'cgi-bin'.For instance, I build it in the root directory of disk D as shown in the screenshot below.
2. After the directories made, come to directory 'C:\Windows\System32' for cmd.exe,then right-click and choose 'Run as an Administrator',
3. Input command D:——>cd D:\PyCharm Community Edition 2019.2.4\www——>python -m http.server --cgi PORTNUMBER( unused ports such as 8001)
4.Input 'localhost:PORTNUMBER' in browser address field to test if the CGI service is activated.
make a python file(.py) under the 'cgi-bin' directory, the code is shown below
Input in the browser address field as below:
Inspiration from Chinese blog https://baijiahao.baidu.com/s?id=1608396131352808822&wfr=spider&for=pc