title: In Django, how to create a DB connection for every thread
body: <p>In my application I have a process that goes over a set of data. For each element of the set I need to run the logic to process it. I have the algorithm running sequentially just fine, but I need to improve run time execution as there are a few QuerySet operations that take time to execute.</p>
  
  <p>How can I allocate a new DB connection for every thread to use? 
  I have seen that I can do:</p>
  
  <pre><code>from django.db import connection
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>connection.close
  </code></pre>
  
  <p>before creating my threads, but that still fails sometimes with a nasty error code from the Oracle library.
  Is there a way to explicitly create a DB connection for the thread so there is no possibility of these DB errors?</p>