2012-12-19 52 views
1

我正尝试在通过xampp运行的apache服务器上运行mod_wsgi的烧瓶应用程序。 我已经尝试阅读已经问过的所有问题,并通过了wsgi的维基,但我仍然无法找到为什么我得到这个错误。 我在Debian 6与Python 2.6.6 我的httpd.conf:脚本标题wsgi的过早结束xampp上的烧瓶

WSGIDaemonProcess debug_tool user=spyglass group=root threads=5 
WSGIScriptAlias /debug_tool /opt/lampp/htdocs/spyglass_v2/debug_tool/debug_tool.wsgi 
<Directory /opt/lampp/htdocs/spyglass_v2/debug_tool> 
    WSGIProcessGroup debug_tool 
    WSGIApplicationGroup %{GLOBAL} 
    Order deny,allow 
    Allow from all 
</Directory> 

我debug_tool.wsgi:

import sys 
sys.path.insert(0,"/opt/lampp/htdocs/spyglass_v2/debug_tool/") 
from debug_tool import app as application 

我debug_tool文件夹看起来是这样的:

ls -rtl 
total 32 
drwxr-xr-x 2 root  root 4096 Dec 18 19:36 uploads 
drwxr-xr-x 2 root  root 4096 Dec 18 19:36 Testing_Paramerters 
drwxr-xr-x 2 root  root 4096 Dec 18 19:36 templates 
-rw-r--r-- 1 root  root 4688 Dec 19 14:42 debug_tool.py 
-rw-r--r-- 1 spyglass root 3859 Dec 19 14:43 debug_tool.pyc 
-rw-r--r-- 1 spyglass root 118 Dec 19 15:17 debug_tool.wsgi 

我的deubg_tool.py看起来像这样:

import os 
import re 
from flask import Flask, request, redirect, url_for, render_template 

app = Flask(__name__) 
app.debug = True 

@app.route('/',methods=['GET']) 
def hello_world(): 

return 'hello world' 

你知道什么可能是错的吗?

更新:

我得到它,当我尝试导入烧瓶中。这意味着什么?

错误日志:

[星期四12月20日12时09分49秒2012] [错误] [客户端172.20.31.135]脚本头过早结束:debug_tool.wsgi [星期四12月20日12时09分49秒2012] [注意] child pid 20206退出信号分割错误(11)

python脚本在实际文件中正确缩进。它可以导入重新和操作系统罚款,但只要我尝试导入烧瓶我得到那个错误

我看着我的httpd.conf文件,我加载mod_php5。 是否可以同时运行?我去了 http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive 但无法弄清楚如何运行这两个模块。

我的总体目标是使用mod_wsgi将此工具添加到运行mod_php5的先前存在的服务器中。谢谢

+0

你能发布HTTPd的error.log的相关部分吗? –

+0

可以肯定的是,你忘了在上面的python代码中格式化缩进还是这是代码的外观? – codecool

+0

尝试通过mod_wsgi FAQ和文档中列出的事情。 http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions#Apache_Process_Crashes首先,您是将mod_php还是mod_python加载到相同的Apache中。 –

回答

0

根据我的经验,脚本标题的过早结束几乎总是由于异常导致的堆栈跟踪。

既然你还没有一个足够大的项目有日志记录功能还没有,我会建议只是包装一切都在尝试,除了打印到标准错误

 

try: 
    YOUR SCRIPT CONTENTS HERE 
except Exception, ex:   
    import sys 

    from traceback import format_list, extract_tb 

    (extype, value, trace) = sys.exc_info() 

    print >> sys.stderr, "%s:%s\n%s" % (extype, value, ''.join(format_list(extract_tb(trace)))) 
 

然后检查Apache的日志输出这可能在

/var/log/httpd/error_log