With Django, storage in a database, generation of the hash code, and exchanges with the client will be transparent. Sessions are stored in the context represented by the request variable. To save a value in a session variable, we must use the following syntax:
Once the session variable is registered, you must use the following syntax to recover it:
Creating and getting session variables
Step 1 : First, we must define the URL
Step 2 : We will create our view in the views.py file with the following code:
Step 3 : Typing the http://localhost:8000/create-session URL in our browser.
Step 4 : Typing the http://localhost:8000/get-session URL in our browser.