Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用fastcgi在共享主机上部署站点_Python_Django_Apache_Fastcgi - Fatal编程技术网

Python 使用fastcgi在共享主机上部署站点

Python 使用fastcgi在共享主机上部署站点,python,django,apache,fastcgi,Python,Django,Apache,Fastcgi,我正试图在Debian VPS上部署名为“dreamhost”的共享主机上的站点。 我跟着 在浏览器中访问服务器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\u nam

我正试图在Debian VPS上部署名为“dreamhost”的共享主机上的站点。 我跟着 在浏览器中访问服务器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\u name/project/
中有一个项目,我在这个目录中创建了两个文件

.hAccess

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]
分派.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错误。
我已经尝试了所有技术,但都没有真正起作用:(

Dreamhost提供了使用WSGI、FastCGI或任何其他方法安装Django的说明。请在他们的wiki上查找。我想地址是。

更新:(由于某些原因,我无法在我的计算机上添加评论)您是否尝试了mod_wsgi?

Dreamhost提供了使用wsgi、FastCGI或任何其他方法安装Django的说明。请在他们的wiki上查找。我想地址是。

更新:(由于某些原因,我无法在我的计算机上添加评论)您是否尝试改为mod_wsgi?

我首先遵循中列出的相同指令,但再次失败使用Dreamhost推荐的wsgi指令。我首先遵循中列出的相同指令,但再次失败使用Dreamhost推荐的wsgi指令。