Plain is headed towards 1.0! Subscribe for development updates →

Sessions - db backed

Manage sessions and save them in the database.

  • associate with users?
  • devices?
 1# Cookie name. This can be whatever you want.
 2SESSION_COOKIE_NAME = "sessionid"
 3# Age of cookie, in seconds (default: 2 weeks).
 4SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
 5# A string like "example.com", or None for standard domain cookie.
 6SESSION_COOKIE_DOMAIN = None
 7# Whether the session cookie should be secure (https:// only).
 8SESSION_COOKIE_SECURE = False
 9# The path of the session cookie.
10SESSION_COOKIE_PATH = "/"
11# Whether to use the HttpOnly flag.
12SESSION_COOKIE_HTTPONLY = True
13# Whether to set the flag restricting cookie leaks on cross-site requests.
14# This can be 'Lax', 'Strict', 'None', or False to disable the flag.
15SESSION_COOKIE_SAMESITE = "Lax"
16# Whether to save the session data on every request.
17SESSION_SAVE_EVERY_REQUEST = False
18# Whether a user's session cookie expires when the web browser is closed.
19SESSION_EXPIRE_AT_BROWSER_CLOSE = False
20# The module to store session data
21SESSION_ENGINE = "plain.sessions.backends.db"