Python command to enable http. server, pythonhttp. server
If you want to use the command E: \ zpic as the download directory, then cd in cmd to this directory and execute the command:
Python-m SimpleHTTPServer
The default port number is 8000. the root directory of the server is the working directory for running python commands.
If an error is prompted:
No module named SimpleHTTPServer
Try the following command:
Python-m http. server
Use http: // 127.0.0.1: 8000 to access contents in the directory.
Or add the port number:Python-m http. server 80
Use http: // 127.0.0.1 to access contents in the directory
Disable the server:
1) dos
Enter "ctrl + C" in the running interface to stop
2) python script
Port listening and related python processes need to be stopped
Def stop_server (server) server. sorket. close ()
======================================
The following three modules are used to build an http server:
1) BaseHTTPServer: provides basic Web services and processor classes, including HTTPServer and BaseHTTPRequestHandler;
2) SimpleHTTPServer: contains the SimpleHTTPRequestHandler class that executes GET and HEAD requests;
3) CGIHTTPServer: contains the CGIHTTPRequestHandler class for processing POST requests and execution.