0

Apache 2.22 および WSGI 3.3 で pinax0.9a2 をデプロイしようとしています。pinax が提供する wsgi.py を使用しています。しかし、Apache エラー ログに 500 エラーと次のエラーが表示されました。

[Sun Aug 19 03:31:55.895469 2012] [core:error] [pid 9045:tid 140546171721472] [client 107.192.29.14:62182] End of script output before headers: wsgi.py

[Sun Aug 19 03:31:56.424077 2012] [core:notice] [pid 7789:tid 140546404792064] AH00052: child pid 9225 exit signal Aborted (6)

[Sun Aug 19 03:31:56.742536 2012] [core:error] [pid 9044:tid 140546196899584] [client 107.192.29.14:62183] Invalid status line from script 'wsgi.py': Status
ng.co: Objects/stringobject.c:115: PyString_FromString: Assertion `str != ((void *)0)' failed.

[Sun Aug 19 03:31:56.966168 2012] [core:error] [pid 9044:tid 140546196899584] [client 107.192.29.14:62183] End of script output before headers: wsgi.py

[Sun Aug 19 03:31:57.426321 2012] [core:notice] [pid 7789:tid 140546404792064] AH00052: child pid 9243 exit signal Aborted (6)

Apache httpd.conf:

<VirtualHost *:80>

    DocumentRoot /usr/local/apache2/mysite

    WSGIDaemonProcess mysite.com python-path=/usr/local/apache2/mysite-env/lib/python2.6/site-packages processes=2 threads=15 display-name=%{GROUP}
    WSGIProcessGroup mysite.com

    WSGIScriptAlias / /usr/local/apache2/mysite/wsgi.py

    <Directory "/usr/local/apache2/mysite">
    Require all granted
    </Directory>

</VirtualHost>

wsgi.py:

from django.core.handlers.wsgi import WSGIHandler

import pinax.env


# setup the environment for Django and Pinax
pinax.env.setup_environ(__file__)


# set application for WSGI processing
application = WSGIHandler()
4

1 に答える 1

0

推測する必要がある場合は、sys.path に pinax が含まれていないためです。私の wsgi スクリプトのほとんどは、mod_wsgi で実行されている python が pinax と django を見つけられるように、システム パスを設定することから始めます。

import sys
sys.path = [
"/home/username/Python/project/project/apps",
"/home/username/Python/project/project",
"/home/username/Python/project/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg",
"/home/username/Python/project/src/django-mailer",
"/home/username/Python/project/src/django-axes",
"/home/username/Python/project/src/django-notification",
"/home/username/Python/project/src/pinax",
"/home/username/Python/project/src/django-email-confirmation",
"/home/username/Python/project/src/idios",
"/home/username/Python/project/src/pil-withg4-dev/PIL",
"/home/username/Python/project/src/django-deployment",
"/home/username/Python/project/lib/python2.7",
"/home/username/Python/project/lib/python2.7/plat-linux2",
"/home/username/Python/project/lib/python2.7/lib-tk",
"/home/username/Python/project/lib/python2.7/lib-old",
"/home/username/Python/project/lib/python2.7/lib-dynload",
"/usr/lib/python2.7",
"/usr/lib/python2.7/plat-linux2",
"/usr/lib/python2.7/lib-tk",
"/home/username/Python/project/local/lib/python2.7/site-packages",
"/home/username/Python/project/local/lib/python2.7/site-packages/PIL",
"/home/username/Python/project/local/lib/python2.7/site-packages/newrelic-1.8.0.13",
"/home/username/Python/project/lib/python2.7/site-packages/PIL",
]

これらの行を wsgi ファイルの先頭に置きます。

于 2013-05-07T18:54:48.297 に答える