我似乎遇到了用mod_wsgi部署django的問題。在過去,我使用mod_python,但我想進行更改。我一直在使用Graham Dumpleton筆記http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango1,但它似乎仍然不起作用。我得到一個內部服務器錯誤。在mod_wsgi上部署django應用程序的問題
django.wsgi file:
import os
import sys
sys.path.append('/var/www/html')
sys.path.append('/var/www/html/c2duo_crm')
os.environ['DJANGO_SETTINGS_MODULE'] = 'c2duo_crm.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
WSGIScriptAlias//var/www/html/c2duo_crm/apache/django.wsgi
Apache httpd file:
<Directory /var/www/html/c2duo_crm/apache>
Order allow,deny
Allow from all
</Directory>
在我的Apache的錯誤日誌,它說我有這樣的錯誤這還不是全部的,但我已經得到了最重要的部分:
[Errno 13] Permission denied: '/.python-eggs'
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] The Python egg cache directory is currently set to:
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] /.python-eggs
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1]
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] Perhaps your account does not have write access to this directory? You can
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Thu Mar 03 14:59:25 2011] [error] [client 127.0.0.1] variable to point to an accessible directory.
我記得當我嘗試使用mod_python進行部署時遇到同樣的問題。我所做的是我在我的httpd文件中設置了'SetEnv PYTHON_EGG_CACHE/tmp',這會起作用。但是這不適用於mod_wsgi。 – Shehzad009 2011-03-03 16:18:14
您是否嘗試使用我鏈接到的WSGIPythonEggs指令?如果錯誤消息沒有提及/ tmp,那麼環境變量沒有被識別。 – 2011-03-03 16:22:05
將'WSGIPythonEggs/tmp'放在apache htppd文件中似乎已經可以使其工作。謝謝 – Shehzad009 2011-03-03 16:45:02