Timeout Django sessions

Fixes #2000

Summary of changes:
* Adds middleware to check last active time.
* Adds listener to logout event to end UserLog logging.
* Adds default 20 minute setting for session timeout.

@aronasorman and @dylanjbarth, please take a look.
PEP 8 recommends we wrap multi-line expressions in parentheses rather than breaking them with `\`. Please change this to that.