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:

<VirtualHost django-site.com:80>
  ServerAdmin webmaster@example.com
  ServerName  django-site.com
  DocumentRoot /home/user/sites/django-site.com/htdocs/
  ErrorLog /var/log/httpd/django-site.com-error.log
  CustomLog /var/log/httpd/django-site.com-access.log 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/wsgi.py process-group=project

</VirtualHost>

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>

<Directory "/home/user/django/project/project">
        <Files wsgi.py>
                Require all granted
        </Files>
</Directory>

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.

Related:


Leave a Reply