I set a session like this:
request.session['mykey']= 33
How do I clear it? I just want to DELETE it.
If you want to use a database-backed session, you need to add 'django. contrib. sessions' to your INSTALLED_APPS setting. Once you have configured your installation, run manage.py migrate to install the single database table that stores session data.
Django creates a unique 32-character-long random string called a session key and associates it with the session data. The server then sends a cookie named sessionid , containing the session key, as value to the browser. On subsequent requests, the browser sends the cookie sessionid to the server.
Django provides a session framework that lets you store and retrieve data on a per-site-visitor basis. Django abstracts the process of sending and receiving cookies, by placing a session ID cookie on the client side, and storing all the related data on the server side.
del request.session['mykey']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With