pythondjangoapachemod-wsgidjango-wsgi

Django + Apache - [core:error] [pid 10696] [client <IP>:35768] Script timed out before returning headers: wsgi.py


I'm trying to deploy a Django app on CentOS + Apache with mod_wsgi. The app is working fine with Django dev server (manage.py runserver) but not when serving through Apache.

This is all I get in logs: [core:error] [pid 10696] [client <IP>:35768] Script timed out before returning headers: wsgi.py

Here's my virtual host config for the domain (The same is working fine for my other projects):

ServerName subdomain.domain.com
ServerAlias another.subdomain.domain.com
DocumentRoot /var/www/path/to/root
ErrorLog /var/www/path/to/logs/error.log
CustomLog /var/www/path/to/logs/requests.log combined


WSGIScriptAlias / /var/www/path/to/root/app/wsgi.py
WSGIDaemonProcess pname python-path=/var/www/path/to/root python-home=/var/www/path/to/root/venv home=/var/www/path/to/root
WSGIPassAuthorization On
WSGIProcessGroup pname
WSGIApplicationGroup %{GLOBAL}

<Directory /var/www/path/to/root/app>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Any help is appreciated. Can't seem to find out any way to get a more verbose error message either.

PS: It might seem like a duplicate question, but it's not. I've looked into all other similar questions but none of the mentioned solutions help.


Solution

  • So the issue was related to mod_wsgi library. Once I compiled mod_wsgi most recent version from source it worked perfectly!

    Instructions are available on their official docs: https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html