On AWS Elastic Beanstalk, on the "64bit Amazon Linux 2017.09 v2.6.0 running Python 3.6" platform, there seems to be a problem with the mod_wsgi
configuration. I see this in /etc/httpd/conf.d/wsgi.conf
:
WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-home=/opt/python/run/venv/ \
python-path=/opt/python/current/app:/opt/python/run/venv/lib64/python3.6/site-packages:/opt/python/run/venv/lib/python3.6/site-packages user=wsgi group=wsgi \
home=/opt/python/current/app
However, I get this in /var/log/httpd/error_log
:
[Mon Nov 20 19:54:44.565076 2017] [:error] [pid 32080] mod_wsgi (pid=32080): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon Nov 20 19:54:44.565444 2017] [:error] [pid 32080] mod_wsgi (pid=32080): Call to 'site.addsitedir()' failed for '/opt/python/run/venv/lib64/python3.6/site-packages:/opt/python/run/venv/lib/python3.6/site-packages'.
Trying to access the site results in this error:
[Mon Nov 20 21:21:21.304605 2017] [:error] [pid 2886] [remote 71.236.217.102:39802] ModuleNotFoundError: No module named 'myappname'
If I change the WSGIDaemonProcess
directive to the following (thus removing the colon-separated paths):
WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-home=/opt/python/run/venv/ \
python-path=/opt/python/current/app user=wsgi group=wsgi \
home=/opt/python/current/app
Then I no longer get the ModuleNotFoundError
.
This appears to be the same bug outlined in https://github.com/GrahamDumpleton/mod_wsgi/issues/92 which was fixed in mod_wsgi
4.4.15. However, the AMI comes pre-installed w/ mod24_wsgi-python36.x86_64==3.5-1.24.amzn1
.
If I try to fix the WSGIDaemonProces
s using an .ebextensions script, it's unfixed by one of the baked-in deploy hooks, and anyway, the defaults as baked appear to be broken by default. How in the world do I fix this?