I was using apache with mod_wsgi to deploy my django project. What I did was:
python manage.py startproject mysite
ServerName www.example.com
ServerAlias example.com
ServerAdmin webmaster@example.com
WSGIDaemonProcess example.com processes=2 threads=15 display-name=%{GROUP} python-path=/root/mysite python-home=/usr
WSGIProcessGroup example.com
WSGIScriptAlias / /root/mysite/mysite/wsgi.py
<Directory /root/mysite/mysite>
Require all granted
</Directory>
You don't need:
python-home=/usr
as you are using the system Python. You only need that if using a Python virtual environment.
Now add:
WSGIApplicationGroup %{GLOBAL}
and see if that changes anything. It shouldn't if this is a brand new Django project, but if you have changed it and are importing certain Python packages that don't work in Python sub interpreters, you will need that.
Also check the Apache error log as it will give you a more precise reason as to why the timeout occurred.
UPDATE 1
If you compiled mod_wsgi yourself and want it to use /usr/local/python3
for the Python installation, you will need to add:
WSGIPythonHome /usr/local/python3
just after the LoadModule
line for wsgi_module
. This is very important if you also have a system Python installation for version 3.6.
You also need to check whether it is picking up the correct shared library. Use ldd
as explained in:
to see what Python shared library it is picking up and whether it is find that under /usr/local/python3/lib
or not. If it is picking up one from /usr/lib
that will cause issues.