带有 fcgi 的 Django 应用程序仅在非守护模式下工作
如果这是一个明显的问题,我很抱歉,但我真的束手无策试图解决这个问题。
我有一个 Django 应用程序,它作为 fcgi 进程运行,并使用 Lighttpd 作为前端服务器。
我首先尝试按照文档中的建议运行 Django FCGI 进程(如下所示)。
python ./manage.py runfcgi method=threaded host=127.0.0.1 port=9030
但是,当我尝试从 Web 浏览器访问该应用程序时,我收到一条 “页面不可用” 消息。
然后我尝试在非守护模式下运行 fcgi 进程(希望在屏幕上看到一些错误消息),这次我能够从浏览器访问该应用程序,并且一切正常。
python ./manage.py runfcgi method=threaded host=127.0.0.1 port=9030 daemonize=false
我在服务器上经历了这种奇怪的行为,而在我的本地开发计算机上,即使 fcgi 进程被守护进程,一切都工作正常。
我也尝试过使用“预分叉”而不是“线程”方法,但这也没有帮助。
我正在发布我的 Lighttpd 配置文件的相关部分,尽管我怀疑它有什么问题...
$HTTP["host"] == "ideas.mydomain.com" {
debug.log-request-handling = "enable"
fastcgi.debug = 1
fastcgi.server = (
"/ideas.fcgi" => (
"main" => (
"host" => "127.0.0.1",
"port" => 9030,
"check-local" => "disable",
)
),
)
url.rewrite-once = (
"^(/.*)$" => "/ideas.fcgi$1",
)
}
来自 Lighttpd 的错误日志有这两行,表明它确实正在尝试连接到 fcgi 进程。
2012-02-28 08:48:49: (mod_fastcgi.c.3071) got proc: pid: 0 socket: tcp:127.0.0.1:9030 load: 1
2012-02-28 08:48:49: (mod_fastcgi.c.1492) released proc: pid: 0 socket: tcp:127.0.0.1:9030 load: 0
有谁知道可能出了什么问题吗?即使我在启动 fcgi 的命令行选项中设置了 debug=true,我也没有看到任何与 fcgi 相关的调试日志。我是否需要执行任何特殊操作才能查看 fcgi 进程的调试日志?
谢谢,非常感谢任何帮助。
I am sorry if this is an obvious problem, but I really at my wits end trying to figure this out.
I have a Django application which I am running as an fcgi process and with Lighttpd as the front server.
I first tried running the Django FCGI process as suggested in the documentation (shown below)
python ./manage.py runfcgi method=threaded host=127.0.0.1 port=9030
However, when I try to access the application from my web browser, I get a 'Page unavailable' message.
Then I tried running the fcgi process in non daemonized mode (hoping to see some error messages on the screen), and this time I was able to access the application from my browser, and everything worked fine.
python ./manage.py runfcgi method=threaded host=127.0.0.1 port=9030 daemonize=false
I experience this strange behavior on the server, whereas on my local development machine, everything works fine even when the fcgi process is daemonized.
I have also tried using 'prefork' instead of 'threaded' method, but that too does not help.
I am posting relevant portions of my Lighttpd config file, though I doubt anything is wrong with it...
$HTTP["host"] == "ideas.mydomain.com" {
debug.log-request-handling = "enable"
fastcgi.debug = 1
fastcgi.server = (
"/ideas.fcgi" => (
"main" => (
"host" => "127.0.0.1",
"port" => 9030,
"check-local" => "disable",
)
),
)
url.rewrite-once = (
"^(/.*)$" => "/ideas.fcgi$1",
)
}
The error log from Lighttpd has these 2 lines which show that it is indeed trying to connect to the fcgi process.
2012-02-28 08:48:49: (mod_fastcgi.c.3071) got proc: pid: 0 socket: tcp:127.0.0.1:9030 load: 1
2012-02-28 08:48:49: (mod_fastcgi.c.1492) released proc: pid: 0 socket: tcp:127.0.0.1:9030 load: 0
Does anyone have a clue about what might be going wrong ? I do not see any fcgi related debug logs, even when I have debug=true in the command line options for starting fcgi. Do I need to do anything special to see debug logs from the fcgi process ?
Thanks, any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先在 lighthttpd 的 config 中启用调试,并设置
fastcgi.debug = 1
。当您打开所有日志记录和调试时,尝试访问该站点以将错误保存在日志中。然后您需要检查主要的错误日志。
默认位置为
/var/log/lighttpd/error.log
。I would start with enabling debugs in the config of lighthttpd and also setting
fastcgi.debug = 1
.When you have all logging and debugging turned on, try to access the site to save the errors in logs. Then you need to examine the main the error log.
The default location is
/var/log/lighttpd/error.log
.