I have a Django application, which has the following code init:
import importlib
def get_class(m):
module_name, class_name = m.rsplit('.', 1)
module = importlib.import_module(module_name)
return getattr(module, class_name)
Whenever I make a request which requires a call of this function, in the error.log I see child pid 27228 exit signal Segmentation fault (11), possible coredump in /etc/apache
, and request fails with error code 500.
The strange thing is that if I call that function from the command line, everything works well. Seems like mod_wsgi does not allow to dynamically load a python module.
I tried to do the following with all combinations:
Use virtual environment
Downloaded sources of python 3.6, compiled and installed it,
Recompiled the mod_wsgi for both default python 3.4.3 and new python 3.6.
The error is always the same:
OS: Ubuntu Server 14.04 Apache: 2.4.7 Python: 3.4.3, 3.6.0
On my Ubuntu Desktop 14.04 everything works fine.
Apache is installed by sudo apt-get install apache2
in /etc/apache2/sites-enabled/000-default.conf
<Directory /my/django/app/appp>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myapp python-path=/my/django/app
WSGIProcessGroup myapp
WSGIScriptAlias / /my/django/app/app/wsgi.py
WSGIApplicationGroup %{GLOBAL}
UPDATE:
I have downloaded and compiled apache2 and recompiled mod_wsgi. Still the same problem.
UPDATE 2: Not sure if this will help, but the OS is on a Azure VM with Ubuntu Server 14.04