我一直在Django本地工作,現在我試圖將一些代碼推送到我運行的Ubuntu服務器上的生產Apache環境(http://www.youtube.com/watch?v=hBMVVruB9Vs)。Django + Apache - wsgi trouble
但是,我只是得到目錄中的文件列表,沒有別的。首先,我通過在終端運行Python命令來確保安裝了Python。
我已經安裝apaache和MOD WSGI用下面的命令:
sudo易於得到安裝的Apache2 命令和apt-get安裝中的libapache2-MOD-WSGI
而且我測試過地看到,其啓用。
這裏是我的wsgi文件firstweb.wsgi它位於根:
import os
import sys
sys.path.append('/var/www/firstweb')
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
這裏是我的firstweb.conf文件:
<VirtualHost *:80>
WSGIScriptAlias//firstweb.wsgi
Alias /static /var/www/firstweb/static
<Directory /var/www/firstweb/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
和我的Django項目位於:/ VAR/www/firstweb/
我真的不能解決這裏有什麼問題,在視頻裏它運行的很好! :(
編輯,這裏是錯誤日誌:
[Sat Feb 16 16:19:31 2013] [notice] Apache/2.2.22 (Ubuntu) configured -- resuming normal operations
[Sat Feb 16 16:20:46 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:20:47 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:20:47 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:37:05 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:37:06 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:37:06 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:37:17 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:20 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:25 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:37:26 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:38:01 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:39:19 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:39:20 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:39:20 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:39:24 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:39:42 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:48:00 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:48:02 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:51 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:49:52 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:49:52 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:49:55 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:56 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:49:58 2013] [error] [client 131.231.153.48] File does not exist: /var/www/favicon.ico
[Sat Feb 16 16:53:21 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:53:22 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:53:22 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 16:55:34 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 16:55:35 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 16:55:35 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Sat Feb 16 17:00:07 2013] [notice] caught SIGTERM, shutting down
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Sat Feb 16 17:00:08 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Sat Feb 16 17:00:08 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
你可以看看你的apache日誌 - 應該在/ var/logs/httpd或/ var/logs/apache – 2013-02-16 17:55:50
我已經看過:/ var/log/apache2 /並且有三個文件,檢出了錯誤日誌,除了python版本不匹配之外,我沒有看到任何明顯的東西: – user2078888 2013-02-16 18:25:53
反正告訴我們 - 當你測試時你會得到什麼屏幕 - 它看起來像什麼?什麼是不工作關於它 – 2013-02-16 18:39:14