Creating and getting a session in Django
- Last modified: 03 February 2020
- Category: django tutorial
in this article, we will create a session in Django
so let's create a session
1.creating a session
syntax:
1 | request.session[ket] = value |
example:
1 | request.session['test'] = 'hello world' |
2.getting session
To get the session above we need to do something like this:
syntax:
1 | request.session.get(session key) |
example:
1 2 | my_session = request.session.get['test'] print(my_session) |
output:
1 | hello world |
English today is not an art to be mastered it's just a tool to use to get a result