2012-07-17 136 views
2

我想在Debian VPS上將共享主機上的網站部署爲「dreamhost」。 我按照django documentation 當我訪問服務器的ip在瀏覽器中我有以下錯誤:使用fastcgi在共享主機上部署網站

The requested URL/was not found on this server. 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 

我有一個項目在/home/user_name/project/我有這個目錄中創建兩個文件。

.htacess

AddHandler fastcgi-script .fcgi 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L] 

dispatch.fcgi

#!/usr/bin/python 
import sys, os 

sys.path.insert(1, '/home/user_name/project') 

# Set the DJANGO_SETTINGS_MODULE environment variable. 
os.environ['DJANGO_SETTINGS_MODULE'] = "project.path.to.settings" 

from django.core.servers.fastcgi import runfastcgi 
runfastcgi(method="threaded", daemonize="false") 

我已經執行了./dispatch.fcgi,它顯示的網站主頁上的終端。當我嘗試在瀏覽器中訪問時總是得到404錯誤,但是什麼都不起作用。 hello.fcgi腳本也給404錯誤。 我已經嘗試了所有的技術,但沒有什麼是真正的工作:(

回答

0

Dreamhost的具有使用WSGI,FastCGI的,或你想要的任何其他方法安裝Django的說明。看看它自己的維基。我想地址是http://wiki.dreamhost.com/Django
更新:(我不能添加我的電腦因爲某種原因在評論)您是否嘗試過的mod_wsgi而不是

+0

我在第一次跟着http://wiki.dreamhost.com/Django_FastCGI所列相同的指令,但?再次失敗 – 2012-07-17 03:20:07

+0

使用Dreamhost推薦的** WSGI **指令。 – shliachtx 2012-10-03 14:30:42

相關問題