1.11.2 Session Module Overview

The web.session module provides three different objects to help users manage sessions. These are:

Driver
These provide the interface to the storage medium for the Manager and Store objects. For example the DatabaseSessionDriver object is used to create a session store in SQL databases.
Manager
These objects are used to handle creation, expiry, loading, validity checks and cleanup of sessions, the handling of cookies and the creation of Store objects.
Store
These are the objects used to set and retrieve the values being stored for the particular application.

To begin using the session store for your application you must perform the following steps:

  1. Create a Driver
  2. Ensure an environment exists for the Driver chosen
  3. Create a Manager object and load an existing session or create a new session
  4. Obtain an application Store object

The web.session module provides web.session.driver() and web.session.manager() functions which you can use to more easily create the correct Driver object and Manager objects respectively.

If you are feeling extremely lazy you can simply use the web.session.start() function to handle everything for you and return a Store object for your application. Alternatively you can use the web.wsgi.session module to handle everything for you if you are using a WSGI application.

If you simply want to get started using the module quickly there is an example later on in the documentation demonstrating some important features and a full API reference.