Django Apache and Virtualenv ImportError: No module named site

后端 未结 4 1114
野的像风
野的像风 2020-12-18 04:05

The error from apache after a 504 page

[info] mod_wsgi (pid=): Python home /var/venv/mybox.
[info] mod_wsgi (pid=): Initializing Python.
ImportError: No mod         


        
4条回答
  •  遥遥无期
    2020-12-18 04:23

    this is taken fron the Documentation write this: WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonPath /path/to/mysite.com

    
    
    Require all granted
    
    
    

    and this is specifically for the virtual env, you need to write the path to the site packeges of your python virtual env:

    WSGIPythonPath /path/to/mysite.com:/path/to/your/venv/lib/python3.X/site-packages
    

    the problem may also be in the - PYTHONHOME

    Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.

    When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.

    Try to clean up your PYTHONHOME:

    user$ export PYTHONHOME=
    

提交回复
热议问题