title: set transaction\query timeout through django?
body: <p>Is there a way to set a timeout in django for db transactions or for db queries executed via django's ORM?</p>
  
  <p><strong>A sample use-case:</strong><br>
  Heroku limits django web requests to 30sec, after which Heroku terminates the request without allowing django to gracefully roll-back any transactions which have not yet returned. This can leave outstanding transactions open on databases such as postgres. You could configure a timeout in the database, but that would also limit non-web-related queries such as maintenance scripts analytics etc. In this case setting a timeout through django (<a href="https://stackoverflow.com/q/19963954/348545">or via the middleware</a>) would be preferable.</p>