title: Auto logout using sessions in Django (outside views)
body: <p>I'm trying to build a auto-logout function in a Django application.</p>
  
  <p>Basically, with each request to the site I want to set the current timestamp in the session (if not set), and then checking that value with the current time. If the difference is too great, it should redirect to logout.</p>
  
  <p>Is there a easy way to set the session on each request without adding a function to each of my views? 
  I know it's possible to use sessions outside views, but then I have to supply the session_key, and I'm not sure where I should get it from, or generate it myself.</p>