The Python command starts the Web server instance elaboration

  • 2020-05-26 09:35:19
  • OfStack

The Python command starts the Web server instance elaboration

You can set up a simple web server with the packages that come with Python. In DOS cd to prepare the server root directory, enter the command:

python-m Web server module [port number, default 8000]

Such as:

python -m SimpleHTTPServer 8080

You can then type in the browser

http://localhost: port number/path

To access server resources.

Such as:

http: / / localhost: 8080 / index htm (of course index. htm files to create your own)

Other machines can also be accessed through the server's IP address.

There are three types of "Web server modules" here:

BaseHTTPServer: provides the basic Web service and processor classes, HTTPServer and BaseHTTPRequestHandler, respectively. SimpleHTTPServer: contains the SimpleHTTPRequestHandler class that performs GET and HEAD requests. CGIHTTPServer: contains the POST request processing and CGIHTTPRequestHandler class execution.

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: