title: Script timed out before returning headers: wsgi.py on elastic beanstalk
body: <p>I'm trying to deploy a Django application to Elastic Beanstalk. When I visit the page it never loads. The logs say:</p>
  
  <pre><code>Script timed out before returning headers: wsgi.py
  </code></pre>
  
  <p>I can ssh into the server and run <code>manage.py runserver</code> and then <code>curl 127.0.0.1:8000</code> from another terminal, which will return the page successfully. So I'm assuming it must be an issue with the Apache configuration that is set up as a part of Elastic Beanstalk.</p>
  
  <p>Here is more of the logs:</p>
  
  <pre><code>[pid 15880] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
  [so:warn] [pid 15880] AH01574: module wsgi_module is already loaded, skipping
  [auth_digest:notice] [pid 15880] AH01757: generating secret for digest authentication ...
  [lbmethod_heartbeat:notice] [pid 15880] AH02282: No slotmem from mod_heartmonitor
  [mpm_prefork:notice] [pid 15880] AH00163: Apache/2.4.9 (Amazon) mod_wsgi/3.4 Python/2.7.5       configured -- resuming normal operations
  [core:notice] [pid 15880] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
  [:error] [pid 15881] /opt/python/run/venv/lib/python2.7/site-packages/numpy/oldnumeric/__init__.py:11: ModuleDeprecationWarning: The oldnumeric module will be dropped in Numpy 1.9
  [:error] [pid 15881]   warnings.warn(_msg, ModuleDeprecationWarning)
  [:error] [pid 15881] 
  [core:error] [pid 15884] [client 10.248.110.45:58996] Script timed out before returning headers: wsgi.py
  </code></pre>
  
  <p>And my wsgi.py file:</p>
  
  <pre><code>import os
  os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aurora.settings")
  
  from django.core.wsgi import get_wsgi_application
  application = get_wsgi_application()
  </code></pre>
  
  <p>Any clues as to what could be causing this?</p>
  
  <p>UPDATE:</p>
  
  <p>I rebuilt my environment and ran into this issue again. I updated <code>/etc/httpd/conf.d/wsgi.conf</code> to include <code>WSGIApplicationGroup %{GLOBAL}</code> <a href="https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Python_Simplified_GIL_State_API">as mentioned here</a>. I am using Scipy, Numpy, and GeoDjango (which uses GDAL). I know GDAL is not entirely thread safe and I'm not sure about the others but I'm assuming it was a thread safety issue.</p>