Django的配置时的mod_wsgi的Apache 1.4将无法向WSGIPythonPath虚拟

2019-07-29 19:10发布

我也跟着上如何部署Django的1.4 Django文档使用mod_wsgi的apache和https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ Mac OSX上的狮子,当我加入WSGIPythonPath指令阿帕奇着重新启动.Yet没有它我的应用程序是在道路不存在的。 在日志中我得到的是一条错误

WSGIPythonPath不能虚拟主机部分内发生

这里是我的虚拟主机的配置看起来像

<VirtualHost *:80>
ServerAdmin jmured@gmail.com
DocumentRoot "/Users/jamo/code/work/projects/bfpd/fapp"
ServerName bfpd.dev
ServerAlias bfpd.dev
ErrorLog "/private/var/log/apache2/bfpd.dev-error_log"
CustomLog "/private/var/log/apache2/bfpd.dev-access_log" common
Alias /static/ /Users/jamo/code/work/projects/bfpd/fapp/fapp/static/
<Directory /Users/jamo/code/work/projects/bfpd/fapp/fapp/static>
  Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
IndexOptions FancyIndexing
</Directory>
WSGIScriptAlias / /Users/jamo/code/work/projects/bfpd/fapp/fapp/wsgi.py
WSGIPythonPath /Users/jamo/code/work/projects/bfpd/fapp/  
    <Directory /Users/jamo/code/work/projects/bfpd/fapp/fapp>
    Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>

   </VirtualHost>

我究竟做错了什么 ???

Answer 1:

我修好了它。 WSGIPythonPath /Users/jamo/code/work/projects/bfpd/fapp/应在http.conf



Answer 2:

作为由nemesisfixx注释中,并在你原来的问题的错误规定:

WSGIPythonPath不能虚拟主机部分内发生

移动WSGIPythonPath虚拟主机之外解决阿帕奇OS X服务器崩溃。

$ cat sites/0000_any_80_mysite.com.conf
WSGIPythonPath /Library/Server/Web/Data/Sites/mysite/django-app:/Users/owen/.virtualenvs/mysite:/Users/owen/.virtualenvs/mysite/lib/python2.7/site-packages

<VirtualHost *:80>
    ServerName mysite.com
    ServerAdmin admin@example.com
    DocumentRoot "/Library/Server/Web/Data/Sites/mysite/site"
    ...
    WSGIScriptAlias /api /Library/Server/Web/Data/Sites/mysite/django-app/mysite/wsgi.wsgi
    ...
<VirtualHost>

我花了很多putzing的对我来说,(添加的virtualenv顶层后自动包括完整路径站点ENV,我最初以为会被包括在内)得到正确的路径。



文章来源: when configuring mod_wsgi for django 1.4 apache fails to start on mac osx after adding WSGIPythonPath to the virtual host config