1
我一直在試圖讓mod_wsgi在Mac OS X服務器上工作,而且我絕對沒有運氣。我已經添加在LoadModule語句到httpd.conf,我已經得到了包括下列文件:無法使mod_wsgi在Mac OS X上與Apache和Django一起使用
apache_django_wsgi.conf:
WSGIDaemonProcess django
WSGIProcessGroup django
Alias /plagtest/ "/Users/plagtest/myproject/"
<Directory "/Users/plagtest/myproject/">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
WSGIScriptAlias /plagtest "/Users/plagtest/myproject/apache/myproject.wsgi"
<Directory "/Users/plagtest/myproject/apache">
Allow from all
</Directory>
這是我的WSGI文件:
myproject.wsgi:
import os
import sys
paths = [ '/Users/plagtest/myproject',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
'/Users/plagtest',
]
for path in paths:
if path not in sys.path:
sys.path.append(path)
sys.executable = '/usr/local/bin/python2.7'
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我可以重新啓動Apache就好了,但是當我瀏覽到localhost/plagtest /它出現找不到文件,這就是我在錯誤日誌中得到:
File does not exist: /Library/WebServer/Documents/plagtest/
我不完全熟悉Apache,我敢肯定,這是可能很簡單,但我無法在網上找到解決方案。任何幫助在這個問題將不勝感激。
我做了這些改變,並且仍然沒有運氣。我仍然在日誌中看到相同的'文件未找到'錯誤:( – Jerrian 2012-07-11 13:27:07
沒有等待,忘記重新啓動Apache:/ 這沒有辦法。謝謝! – Jerrian 2012-07-11 14:00:02
很高興它的工作! – 2012-07-11 20:28:05