python - 如何在 Fedora 17 上将 FCGI 与 Python(和 Django)结合使用?

标签 python apache fedora fastcgi

我在访问“index.fcgi”时遇到问题;我不断收到 500 内部服务器错误。 这是我的错误日志:

[Thu Aug 09 19:40:17 2012] [warn] [client 127.0.0.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Thu Aug 09 19:40:17 2012] [error] [client 127.0.0.1] Premature end of script headers: index.fcgi

这是我的 .htaccess 文件中的内容:

Options +ExecCGI
Options +Indexes
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.fcgi/ [QSA,L]

这是我的index.fcgi:

#!/usr/bin/python2.7
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

print "Content-type: text/html\n\n"
print
print "<html>"
print "<body>"
print "<b>test</b>"
print "</body>"
print "</html>"

我什至删除了 django import 和 runfastcgi 组件,但我仍然无法看到我的页面。

为什么这种事会发生在我身上?我确实安装了 mod_python、mod_wsgi、mod_fcgid、mod_fcgi,但似乎没有任何东西可以使其运行...

最佳答案

有一个方法可以解决这个问题:cd到index.fcgi所在目录并运行./index.fcgi
- 这将为您提供确切的错误。

关于python - 如何在 Fedora 17 上将 FCGI 与 Python(和 Django)结合使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11894780/

相关文章:

python - np_utils.to_categorical 反向

python - 如果像 Fedora 的 devassistant 和 virtualenv 这样的工具存在的话,docker 会如何变得更好呢?

c++ 程序在一个线程发生访问冲突时终止 - 如何在 linux 中捕获此问题 - 对于 win32 我在 vs2010 中获得堆栈跟踪

c++ - 第一次读取时文件读取速度较慢,但​​连续读取时速度很快

python - 配置第三方脚本的日志记录

python - Django URLconf : How to use captured params in include's RedirectView?

python - 如何将 Python flask 应用程序加载到 gtk webview (Webkit)

php - iReport 在 Linux 终端中运行,但无法使用 PHP exec 命令

java - 为什么 apache 执行我的 shell 脚本中的所有命令而不是 java 的命令?

apache - mod_rewrite - 防止多次重定向