HTTP – the basics of the GET and POST methods
Hypertext Transfer Protocol (HTTP) allows a client (for example, the web browser) to interact with a server (our application). Given a URL of a server web page, the GET method is the way the client queries data from the server, specifying some parameters. This can be explained using the curl
command, as follows:
curl -X GET url_path?name1=value1&name2=value2
After the ?
symbol, the name/value pair specifies which data to query, and they are separated by a &
symbol.
The way a client transfers data to the server is called POST, and the data is in the body of the call:
curl -X POST -d @datafile.txt url_path
Now we can start discussing how to create a new server and an application using Django.
Installation and server creation
The Django library is installed by typing the following command in the Terminal:
sudo pip instal django
The command should install Django Version 1.7 or above (the author used version 1.7). In order to start a new app...