Python 没有模块名django.core.wsgi apache2+;ubuntu+;mod_wsgi

Python 没有模块名django.core.wsgi apache2+;ubuntu+;mod_wsgi,python,django,apache,hosting,mod-wsgi,Python,Django,Apache,Hosting,Mod Wsgi,我已经设置了wsgipythonpath和daemonprocess,但是错误日志显示了上面的错误:没有名为django.core.wsgi的模块,我正在共享我的配置文件,可能是什么错误,以及如何检查apache是否可以访问我的django安装我可以在本地系统上使用相同的配置托管,但不能在远程服务器上托管 WSGIPythonPath /home/env_mysite/lib/python2.7/site-packages <VirtualHost *:80> ServerNa

我已经设置了wsgipythonpath和daemonprocess,但是错误日志显示了上面的错误:没有名为django.core.wsgi的模块,我正在共享我的配置文件,可能是什么错误,以及如何检查apache是否可以访问我的django安装我可以在本地系统上使用相同的配置托管,但不能在远程服务器上托管

WSGIPythonPath /home/env_mysite/lib/python2.7/site-packages
<VirtualHost *:80>
   ServerName  localhost
   DocumentRoot /home/unixadmin/PBpy

   WSGIScriptAlias / /home/unixadmin/PBpy/PBpy/wsgi.py

   WSGIDaemonProcess PBpy python-path=/home/env_mysite/lib/python2.7/site-packages

   ErrorLog /home/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined

   <Directory "/home/unixadmin/PBpy">
     Require all granted
   </Directory>
WSGIPythonPath/home/env_mysite/lib/python2.7/site-packages
服务器名本地主机
DocumentRoot/home/unixadmin/PBpy
WSGIScriptAlias//home/unixadmin/PBpy/PBpy/wsgi.py
WSGIDaemonProcess PBpy python path=/home/env_mysite/lib/python2.7/site-packages
ErrorLog/home/error.log
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
要求所有授权

WSGIDaemonProcess

WSGIDaemonProcess <env> python-path=<path to project code> python-home=<path to env>
WSGIDaemonProcess python path=python home=

希望这会有所帮助。

mod_wsgi配置有两个突出之处

1-使用
WSGIDaemonProcess
,但不使用
WSGIProcessGroup
,也不使用
WSGIScriptAlias
application group
选项,将WSGI应用程序委托到守护进程组中运行

2-使用mod_wsgi设置Python虚拟环境时,不使用推荐的方法。见:

由于您试图使用Python虚拟环境,另一个可能的问题是您的mod_wsgi是否为Python 2.7编译,尤其是为相同的Python安装编译。您的Python虚拟环境是在同一目标系统上使用系统Python 2.7安装创建的吗

其他奇怪的事情或问题来源包括:

1-
ServerName
不应设置为
localhost
。如果这恰好是Apache找到的第一个
VirtualHost


2-在Apache下运行代码的用户通常无法访问主目录,因此它甚至可能无法看到Python包

很抱歉,这没有帮助,我可以在本地系统上使用与上述配置相同的apache托管,但我不知道为什么在服务器上尝试时会出现这样的错误。任何进一步的帮助都将不胜感激。当我能够在我的ubuntu机器上切换到root时,我应该给予python包什么样的权限?您是否先修复了所有其他问题,并确保您的mod_wsgi是为正在使用的相同python安装编译的?使用签入确保使用了正确的Python虚拟环境,并且正确构造了
sys.path
。目录至少应该是
o+rx
和文件
o+r
。如果你不明白那意味着什么,请阅读