简体   繁体   English

在为django 1.4配置mod_wsgi时,在将WSGIPythonPath添加到虚拟主机配置后,apache无法在mac osx上启动

[英]when configuring mod_wsgi for django 1.4 apache fails to start on mac osx after adding WSGIPythonPath to the virtual host config

I followed the django docs on how to deploy django 1.4 to apache using mod_wsgi https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/ on mac osx lion and when I add the WSGIPythonPath directive apache cant restart .Yet without it my app is non existant in the path . 我跟着django文档讨论了如何在mac osx lion上使用mod_wsgi https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/将django 1.4部署到apache,当我添加WSGIPythonPath指令apache cant时重新启动。如果没有它,我的应用程序在路径中是不存在的。 In the log I am getting an error that reads 在日志中我收到一个错误

WSGIPythonPath cannot occur within VirtualHost section WSGIPythonPath不能在VirtualHost部分中出现

here is what my virtual host config looks like 这是我的虚拟主机配置的样子

<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>

what am i doing wrong ??? 我究竟做错了什么 ???

I fixed it. 我修好了它。 WSGIPythonPath /Users/jamo/code/work/projects/bfpd/fapp/ should be in http.conf WSGIPythonPath /Users/jamo/code/work/projects/bfpd/fapp/应该在http.conf

As mentioned in the comment by nemesisfixx, and specified by the error in your original question: 如nemesisfixx的评论中所述,并由原始问题中的错误指定:

WSGIPythonPath cannot occur within VirtualHost section WSGIPythonPath不能在VirtualHost部分中出现

Moving WSGIPythonPath outside of VirtualHost resolved Apache crashing on OS X server. 在VirtualHost之外移动WSGIPythonPath解决了Apache在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>

It took a lot of putzing for me to get the paths correct (including full path to site-env, which I initially thought would be included automatically after adding the virtualenv top level). 我花了很多putzing的对我来说,(添加的virtualenv顶层后自动包括完整路径站点ENV,我最初以为会被包括在内)得到正确的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM