[英]No module name django.core.wsgi apache2+ubuntu+mod_wsgi
I have set up my wsgipythonpath and daemonprocess but the error log shows the above error no module named django.core.wsgi, i am sharing my conf, what could be the error, and how can i check if apache can acess my django installation or not. 我已经设置了wsgipythonpath和daemonprocess,但错误日志显示上述错误,没有名为django.core.wsgi的模块,我正在共享conf,可能是错误,以及如何检查apache是否可以访问django安装或不。 I am able to host with same config on my local system but not on a remote server 我可以在本地系统上托管相同的配置,但不能在远程服务器上托管
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>
Try this for WSGIDaemonProcess
为WSGIDaemonProcess
尝试这个
WSGIDaemonProcess <env> python-path=<path to project code> python-home=<path to env>
hope this is helpful. 希望这会有所帮助。
Two things stand out about the mod_wsgi configuration. 关于mod_wsgi配置有两点突出。
1 - You use WSGIDaemonProcess
but don't use WSGIProcessGroup
, or the application-group
option to WSGIScriptAlias
, to delegate the WSGI application to run in the daemon process group. 1 -您可以使用WSGIDaemonProcess
但不要用WSGIProcessGroup
,或application-group
选项WSGIScriptAlias
,委派WSGI应用程序守护进程组中运行。
2 - You don't use the recommended way of setting up a Python virtual environment with mod_wsgi. 2-您没有使用通过mod_wsgi设置Python虚拟环境的推荐方法。 See: 看到:
A further possible issue since you are trying to use a Python virtual environment is whether your mod_wsgi is even compiled for Python 2.7, and specifically the same Python installation. 自尝试使用Python虚拟环境以来,另一个可能的问题是您的mod_wsgi是否甚至针对Python 2.7(特别是相同的Python安装)进行编译。 Was your Python virtual environment created using the system Python 2.7 installation, on the same target system? 您是否在同一目标系统上使用系统Python 2.7安装创建了Python虚拟环境?
Other odd things or sources of problems are: 其他奇怪的事情或问题的根源是:
1 - ServerName
shouldn't be set to localhost
. 1- ServerName
不应设置为localhost
。 Things would only still work if that happened to be the first VirtualHost
Apache finds. 只有碰巧是Apache首次发现VirtualHost
时,一切仍然可行。
2 - Home directories are often not accessible to user that your code is run as under Apache, so it may not even be able to see the Python packages. 2-通常无法在Apache下运行代码的用户访问主目录,因此它甚至可能看不到Python软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.