Raspberry_Pi_Education_Manual

Notes:

Lesson 4.4: Web applications

A web application is a program that communicates on the World Wide Web. Like any other program, it has inputs, processes them and produces some output. Not every input and output from a web application has to be through a web browser, though! The World Wide Web uses something called HTTP (Hyper Text Transfer Protocol). This is what web servers and web browsers use to communicate with each other at a low level. The port number used for HTTP is 80. The detail of how HTTP works does not need to concern us at this stage – all the work is done for us by web browsers and libraries in Python. A URL (Uniform Resource Locator), otherwise known as a web address, is what you would type into the address bar of a web browser. It can be made up of a few parts: Protocol For a website, this is normally “HTTP:” but doesn’t have to be. Secure websites use the encrypted “HTTPS:” protocol, and most browsers can also work with the file transfer protocol (“FTP:”). Hostname This is the name of the computer, the web server, on which the website resides. In these examples, we use the hostname “localhost”, which means the computer on which a program resides. Port This is a number between 1 and 65,535, specifying the TCP port to be used for the communication. If not specified, the default port, 80, is used. Address This is the address of the specific webpage that you want to view. For instance, in the URL www.raspberrypi.org/faqs the suffix “faqs” is the address. HTML (Hypertext Markup Language) is a language used to describe the layout of a web page. In both of these examples here, you will notice that the web page created is fairly basic. Imagine how you can improve this just by modifying the HTML! protocol :// hostname : port / address Let’s look at those parts in order:

Tip...

If you want to find out the IP address of

your Raspberry Pi, open the Terminal, type the command

“ifconfig” and press Return. This command does the same

job as “ipconfig” on a MS Windows computer.

Human-computer interfacing

120

Made with FlippingBook flipbook maker