title: Django and threading.local() quirks?
body: <p>Recently I've started using threading.local() as way for some apis to store and access state for duration of request without having to access request object.</p>
  
  <p>So lets say I have certain code:</p>
  
  <pre><code>_thread_local = threading.local()
  _thread_local.theme = 'darkblues'
  </code></pre>
  
  <p>How long does that <code>_thread_local.theme</code> variable lasts? Do I have to manually unset it at the end of request in, say, custom middleware? Or it's deleted by Django automatically after it finishes processing request?</p>