January 2019
Beginner
318 pages
8h 23m
English
In this section, we are going to learn about a module from the http package, the http.server module. This module defines the classes used for implementing HTTP servers. It has two methods: GET and HEAD. By using this module, we can share files over a network. You can run the http server on any port. Make sure the port number is greater than 1024. The default port number is 8000.
You can use http.server as follows.
First, navigate to your desired directory and run the following command:
student@ubuntu:~/Desktop$ python3 -m http.server 9000
Now open your browser and write localhost:9000 in your address bar and press Enter. You will get the output following:
student@ubuntu:~/Desktop$ python3 -m http.server 9000 ...
Read now
Unlock full access