ImportError: No module named site. On CentOS 7 + python3.5

I’m trying to setup server few days in a row with no luck, I checked all the related topics and didn’t find solution for the problem.
I’m using CentOS 7, mod_wsgi, apache, python3.5 under virtualenvironment
Here is a conf file:

  DocumentRoot /home/user/sites/
  ErrorLog /var/log/httpd/
  CustomLog /var/log/httpd/ combined
  # WSGIDaemonProcess project python-home=/home/user/django/project/.venv python-path=/home/user/django/project:/home/user/django/project/.venv/lib/python3.5/site-packages/
  WSGIDaemonProcess project processes=2 threads=15
  WSGIProcessGroup project
  WSGIScriptAlias / /home/user/django/project/project/ process-group=project


WSGIPythonHome /home/user/django/project/.venv

Alias /static /home/user/django/project/static_root
<Directory /home/user/django/project/static_root>
    Require all granted

<Directory "/home/user/django/project/project">
                Require all granted

And with this configuration I’m getting ImportError: No module named site.
If I remove python home directive or param to WSGIDaemonProcess, I get following error in apache log RuntimeError: populate() isn't reentrant.
I can run django with runserver command with virtualenv python, so this must be something to do with server sonfiguration. Any help would be appreciated.


Leave a Reply