我想用FastCGI在iPage.com上設置django共享託管,但我一直在遇到問題。 CGI腳本在瀏覽器中作爲文本而不是執行。下面是的.htaccess和FCGI腳本在共享的FastCGI主機上託管Django
.htacess
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/mysite.fcgi/$1 [QSA,L]
,並在下面的FCGI腳本
#!/usr/bin/python
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/home/users/web/b2374/ipg.navtejportfoliocom/django")
# Switch to the directory of your project. (Optional.)
os.chdir("/home/user/myproject")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "tej.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
什麼我不這樣做對嗎?
fcgi不能在根文件夾上工作,所以我決定將它複製到CGI。加上djangoproject建議使用fcgi作爲django,因爲cgi包含對每個加載的頁面的python + django +內容的調用,而fcgi消除了重新制作 – 2010-07-27 06:05:24