What is the difference between BaseHTTPServer
and SimpleHTTPServer
?
When and where should I use these?
HTTP Web Server is simply a process which runs on a machine and listens for incoming HTTP Requests by a specific IP and Port number, and then sends back a response for the request.
CTRL+C is pressed to stop the server.
BaseHTTPServer
is a HTTP server library. It understands the HTTP protocol and let your code handle requests. It doesn't have any "logic" on it's own. SimpleHTTPServer
is built on top of BaseHTTPServer
and handles requests in a similar way normal HTTP servers do, i.e. serve files from the file-system. In most cases you will want only BaseHTTPServer
, as a base for implementing some development server for a web application.
If you are interested in working on a web application, not writing a HTTP server, you are probably looking for the WSGI interface. It allows you to write web aplications without depending on a specific server. There are also multiple frameworks that simplify the process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With