4.4 Running a Webserver with Python

A simple webserver is launched using Python with a single line of code. This server returns a plain HTML page with a directory listing from the kit.

To launch a webserver, perform the following steps:

  1. Run the following command on the kit (either through SSH or UART).
    python3 -m http.server
  2. Open a browser on your PC and point to the IP address of the kit and port 8000, for example, 10.145.200.55:8000. The webserver opens.
    Note: To obtain the IP address of your kit refer back to step 4 of the Setting the System Time, Installing Packages, and Connecting through SSH section.
    Figure 4-8. Running the Webserver