Detailed explanation of Python command to start a web server instance
You can create a simple web server using the packages that come with Python. In DOS, cd to the path to be the server root directory and enter the command:
python -m Web server module [port number, default 8000]
For example:
python -m SimpleHTTPServer 8080
Then you can enter
# in the browser ##http://localhost:port number/path
to access server resources.
For example:
http://localhost:8080/index.htm (of course you have to create the index.htm file yourself)
Other machines can also be accessed through the server's IP address.
There are three types of "Web server modules" here:
- BaseHTTPServer: Provides basic Web services and processor classes, namely HTTPServer and BaseHTTPRequestHandler .
- SimpleHTTPServer: Contains the SimpleHTTPRequestHandler class that performs GET and HEAD requests.
- CGIHTTPServer: Contains the CGIHTTPRequestHandler class for processing POST requests and executing.
Thank you for reading, I hope it can help you, thank you for your support of this site!
For more articles related to Python commands to start Web server instances, please pay attention to the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn