title: Gunicorn worker timeout
body: <p>I have a Django application running in Gunicorn behind Nginx. Everything works fine, exect for one strange thing: I have a "download" view and a RESTful json API. When call the download view I use urllib2 to access the json API to get information. And excactly when I try to do this http get request to the json api, the request times out with an error HTTP Error 504: Gateway Time-out.</p>
  
  <p>When I run the code with ./manage.py runserver everything works fine. The http get request to the json api also only takes a few miliseconds, so no danger of running into a timeout.</p>
  
  <p>Here the Situation in Pseudo code:</p>
  
  <p><strong>myproject/views.py:</strong> (accessible as: <a href="http://myproject.com/download" rel="noreferrer">http://myproject.com/download</a>)</p>
  
  <pre><code>1   def download(request, *args, **kwargs):
  2       import urllib2
  3       opener = urllib2.build_opener()
  4       opener.open('http://myproject.com/api/get_project_stats')
  </code></pre>
  
  <p>The <code>opener.open()</code> call in line four runs into a timeout when running in Gunicorn, when running with <code>./manage.py runserver</code>everytihng works fine (and the api call only takes a few miliseconds.</p>
  
  <p>Has anyone had the same problem? And more important: How have you solved it?</p>