【发布时间】:2012-07-15 23:06:15
【问题描述】:
我正在尝试在他们的 Debian VPS 上将站点部署在名为“dreamhost”的共享主机上。 我关注了django documentation 当我在浏览器中访问服务器 ip 时出现以下错误:
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 错误。
我已经尝试了所有技术,但没有任何效果:(
【问题讨论】:
标签: python django apache fastcgi