Python Web Server

A webserver is a program that listens for a request for a web page.
When you use your browser it requests the page that you want to see.
The webserver hears the request and sends the page you wanted.
The browser receives it and displays it.

So, to see your own html pages in a browser, you need to run a webserver on your laptop.

Running a webserver like this means that you can see html pages which are stored locally - on your own laptop - instead of pages which are somewhere on the internet.

When pages are served up like this your machine is called a 'localhost'.

It is easy to run a webserver on your computer but you do need to have the Python programming language installed on your machine. Python is free and can be downloaded from here: Python

Once you have downloaded Python you are ready to start a webserver, just follow the instructions below.

Start a python web server as follows:

On Windows, start by opening a command window.
On Linux, open a terminal.

When you have finished using the webserver close it using Ctrl+c.

Notes

The number at the end of the command to start the webserver is the port that it will use.
Any number can be used in place of 8000. However, a port number below 1024 may give you 'permission denied' errors.
Use the same number at the end of the url in the browser.

An alternative to the command to start the webserver is:
python3 -m http.server --bind 127.0.0.1
This command uses port number 8000 by default.
The url for the browser is the same as before:
http://localhost:8000