0
嘗試在使用mod_wsgi的CentOS 6上的apache上設置Django,但我不確定我的安裝錯誤。我已經嘗試了很多不同的設置指南,但我總是在Apache日誌相同的錯誤:使用mod_wsgi在apache上設置Django
[Mon Mar 31 19:51:22 2014] [error] [client ::1] mod_wsgi (pid=39608): Target WSGI script '/opt/django/movies/movies/wsgi.py' cannot be loaded as Python module.
[Mon Mar 31 19:51:22 2014] [error] [client ::1] mod_wsgi (pid=39608): Exception occurred processing WSGI script '/opt/django/movies/movies/wsgi.py
[Mon Mar 31 19:51:22 2014] [error] [client ::1] Traceback (most recent call last):
[Mon Mar 31 19:51:22 2014] [error] [client ::1] File "/opt/django/movies/movies/wsgi.py", line 16, in <module>
[Mon Mar 31 19:51:22 2014] [error] [client ::1] from django.core.wsgi import get_wsgi_application
[Mon Mar 31 19:51:22 2014] [error] [client ::1] ImportError: No module named wsgi
wsgi.py
import os
import sys
sys.path.append('/opt/django/movies/movies')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
/etc/httpd/conf/httpd.conf中
<VirtualHost *:80>
WSGIScriptAlias//opt/django/movies/movies/wsgi.py
ServerName localhost
DocumentRoot "/opt/django/movies"
<Directory /opt/django/movies/movies>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
看起來像你的服務器上沒有啓用wsgi(我甚至沒有看到我的mods_available文件夾中的wsgi) - 如果你只是啓用了這樣的mod,你重新啓動了服務器嗎? –