What is a POST Request?

HTTP

Before, we spoke about the internet. We described servers and clients, but that's only half of the internet. The internet is basically infrastructure and a set of protocols.

By infrastructure, I mean that the internet is literally comprised of a bunch of computers. My computer, your computer, every server at Google, etc.

By protocols, I mean the language that these computers use to speak to one another.


There's a few lower level protocols (like TCP/IP -- look it up if you're interested in what that is) that computers use to communicate. Here, though, we're going to worry about the layer above TCP/IP known as HTTP.

HTTP stands for Hypertext Transfer Protocol (you may have also seen HTTPS, which is just the secure, encrypted version of HTTP). HTTP is a language that these computers use to speak to each other over the internet.

HTTP has what it calls "methods." Each of these methods has a convention of when it is used. So far, we've only been using the GET method (if you look at your views.py every method in every view is called get ). This is because so far, we haven't been making any changes to our database in our views -- we've only been making queries and requesting info from our database. For this kind of work, you always use a GET request.

If you need to make a change to state (change the database), you'll use a POST request. How do we do this in django? Literally just call the method post.

results matching ""

    No results matching ""