I'm trying to deploy a Django application to Elastic Beanstalk. When I visit the page it never loads. The logs say:
Script timed out before returning headers: wsgi.py
I can ssh into the server and run manage.py runserver
and then curl 127.0.0.1:8000
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.
Here is more of the logs:
[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
And my wsgi.py file:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "aurora.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Any clues as to what could be causing this?
UPDATE:
I rebuilt my environment and ran into this issue again. I updated /etc/httpd/conf.d/wsgi.conf
to include WSGIApplicationGroup %{GLOBAL}
as mentioned here. 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.