2015-01-07 96 views
0

我使用django創建了一個網站,並試圖用我的apache服務器設置mod_wsgi。Django的內部500錯誤:試圖設置mod_wsgi

當我去我的網站,我得到這個錯誤:

Internal Server Error 

The server encountered an internal error or misconfiguration and was unable to complete your request. 

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. 

More information about this error may be available in the server error log. 

這是錯誤日誌文件當我嘗試建立的mod_wsgi我得到:

[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] mod_wsgi (pid=18513): Target WSGI script '/var/www/firstweb/firstweb/wsgi.py' cannot be loaded as Python module. 
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] mod_wsgi (pid=18513): Exception occurred processing WSGI script '/var/www/firstweb/firstweb/wsgi.py'. 
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] Traceback (most recent call last): 
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] File "/var/www/firstweb/firstweb/wsgi.py", line 13, in <module> 
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4]  from django.core.wsgi import get_wsgi_application 
[Wed Jan 07 16:08:01 2015] [error] [client 108.200.246.4] ImportError: No module named django.core.wsgi 

下面是我的httpd .conf文件:

WSGIScriptAlias /mahi/ /var/www/firstweb/firstweb/wsgi.py 
WSGIPythonPath /var/www/firstweb/ 

<Directory "/var/www/firstweb/firstweb"> 
<Files wsgi.py> 
    Order allow,deny 
    Allow from all 
</Files> 

</Directory> 

請幫幫我。我沒有方向去哪裏。

回答

0

看來,Python路徑是不完整的。 如果你使用全局Python安裝,在Ubuntu中是這樣的。

WSGIPythonPath /var/www/firstweb/:/usr/local/lib/python3.4/dist-packages