Chapter 16. Managing Sessions and Cookies

What You’ll Learn in This Hour

  • How Django’s session framework works
  • How to configure the session manager
  • How to use Django’s test cookies to verify that the browser supports cookies
  • How to add and retrieve session data using the session attribute of the HttpRequest object
  • How to set and retrieve cookies using the HttpRequest object

In the past couple of hours, we have covered implementing users and authentication. Now it is time to discuss implementing a session framework that will allow you to provide a persistent state for user data.

As a user browses the website and does various activities, you may want to retain certain data about that user’s activities. Generally this is accomplished by setting cookies ...

Get Sams Teach Yourself Django in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.