我正试图让mod在Apache2下运行,并希望与Django一起使用它。
现在,我只是让一个基本的应用程序运行,并得到一个分段错误。任何关于如何跟踪错误的建议将不胜感激,我被卡住了。
这是Debian/Lenny,Apache,mod和python2.5的股票版本。我已经检查并将mod链接到/usr/lib/libpython2.5.so.1.0。我最初安装了python2.4,但为了防止错误的版本,我将其删除。
脚本文件是:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]我的配置是:
WSGIScriptAlias /myapp /var/www/test/myapp.wsgi
<Directory /var/www/test/myapp.wsgi>
Order allow,deny
Allow from all
</Directory>当我试图查看url时,我会在apache错误日志中看到这一点。
[Fri Nov 19 09:29:58 2010] [info] mod_wsgi (pid=7190): Create interpreter 'morpheus.gateway.2wire.net|/myapp'.
[Fri Nov 19 09:29:58 2010] [info] mod_wsgi (pid=7331): Attach interpreter ''.
[Fri Nov 19 09:29:58 2010] [notice] child pid 7190 exit signal Segmentation fault (11)Python似乎运行得很好,否则,我已经在内置服务器下运行了django应用程序,没有问题。
只是FYI,我一开始试着让django应用程序运行,但是遇到了以下错误:
[Fri Nov 19 08:25:08 2010] [info] mod_wsgi (pid=6861): Create interpreter 'morpheus.gateway.2wire.net|/curtana'.
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] mod_wsgi (pid=6861): Exception occurred processing WSGI script '/var/data/curtana/curtana.wsgi'.
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] File "/var/data/curtana/curtana.wsgi", line 1
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] import sys
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] ^
[Fri Nov 19 08:25:08 2010] [error] [client 192.168.2.70] SyntaxError: invalid syntax这似乎让我尝试一下基本的应用程序。
谢谢你的建议。
编辑以添加,这里有一个回溯:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb751a700 (LWP 8092)]
0xb6b3a920 in PyParser_AddToken (ps=0x8543f90, type=8, str=0x845a480 ")",
lineno=1, col_offset=39, expected_ret=0xbfffe378) at ../Parser/parser.c:274
274 ../Parser/parser.c: No such file or directory.
in ../Parser/parser.c
(gdb) backtrace
#0 0xb6b3a920 in PyParser_AddToken (ps=0x8543f90, type=8, str=0x845a480 ")",
lineno=1, col_offset=39, expected_ret=0xbfffe378) at ../Parser/parser.c:274
#1 0xb6b3ab86 in parsetok (tok=0x8535460, g=<value optimized out>, start=257,
err_ret=0xbfffe360, flags=<value optimized out>)
at ../Parser/parsetok.c:194
#2 0xb6bec5eb in PyParser_SimpleParseFileFlags (fp=0x84f3288,
filename=0x85301b0 "/var/www/test/myapp.wsgi", start=257, flags=0)
at ../Python/pythonrun.c:1404
#3 0xb6c76877 in ?? () from /usr/lib/apache2/modules/mod_wsgi.so
#4 0x084f3288 in ?? ()
#5 0x085301b0 in ?? ()
#6 0x00000101 in ?? ()
#7 0x00000000 in ?? ()发布于 2010-11-19 19:47:24
阅读mod_wsgi文档,寻找它讨论崩溃的位置。从以下方面开始:
http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions http://code.google.com/p/modwsgi/wiki/InstallationIssues
可能与mod_python发生冲突,或者因为运行时发现了错误的Python安装。
以后,进行安装检查,如以下所述:
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation
更新1
注释中提到的堆栈跟踪的生成记录在以下文件中:
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
https://stackoverflow.com/questions/4226521
复制相似问题