Beaker sessions with file backend.

The Beaker documentation mentions that you can use a file backed session backend, along with numerous other methods (memory, dbm, various SQL flavors, even Google App Engine datastore).

What they don’t explain is how you actually use a file backend, and searching around was turning up nothing. It turns out to be similar to how you configure Beaker caching, a la with data and lock directories:

session_app = beaker.middleware.SessionMiddleware(app,
                                                  type='file',
                                                  data_dir='/path/to/some/dir',
                                                  lock_dir='/path/to/another/dir')