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?
 1from importlib import import_module
 2
 3import click
 4
 5from plain.runtime import settings
 6
 7
 8@click.group()
 9def cli():
10    """Sessions management commands."""
11    pass
12
13
14@cli.command()
15def clear_expired():
16    engine = import_module(settings.SESSION_ENGINE)
17    try:
18        engine.SessionStore.clear_expired()
19    except NotImplementedError:
20        raise NotImplementedError(
21            "Session engine '%s' doesn't support clearing expired "
22            "sessions." % settings.SESSION_ENGINE
23        )