Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Django, how do I clear a sessionkey?

I set a session like this:

request.session['mykey']= 33

How do I clear it? I just want to DELETE it.

like image 649
TIMEX Avatar asked Mar 03 '10 22:03

TIMEX


People also ask

How do I use file based sessions in Django?

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.

What is session key in Django?

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.

What is session and cookies in Django?

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.


1 Answers

 del request.session['mykey']
like image 97
jball Avatar answered Oct 06 '22 20:10

jball