requestobject provided by Django as the default argument in views. For those unfamiliar with Django, this web framework is written in Python by experienced developers using a batteries-included concept. For more information regarding this amazing web framework please access:
requestobject is exposed:
Create and activate a virtual environment
Install Django - using PIP
Create the project folder
.at the end of the command.
Create the database and the app tables
Start the application
Update settings to include the new app -
Update routing -
Code out first route and get access to the
requestobject in Django comes with a few interesting properties:
How to check the request type in view.
POST(when we send information to the server, login action for instance):
GETis used to pull information from the server without altering anything. Search is a good example of a
GETrequest when we try to locate information on Google or Wikipedia.
POSTis used to update the information on the server like change the title for a book or register a new item in our service.
POSTis the location of the submitted information.
List all request headers
POSTrequests populated with all variables sent by the client. We can access the variables by
get()helper for both cases.
Read GET variables
For POST, the process is identical.