我正在运行python金字塔应用程序并对其进行调用。它是一个wsgi应用程序,并使用女服务员作为http服务器。目前,当我发出失败的http请求时,我会收到如下消息:
Internal Server Error
The server encountered an unexpected internal server error
如何配置waitress或paster本身以获取显示堆栈跟踪的错误,如下所示:
Traceback (most recent call last):
File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/channel.py", line 337, in service
task.service()
File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/task.py", line 173, in service
self.execute()
...
File "/.../pyramid/eggs/pyramid-1.4.5-py2.7.egg/pyramid/config/views.py", line 469, in _class_requestonly_view
response = getattr(inst, attr)()
File "/.../pyramid/dustin/views.py", line 139, in delete
raise Exception('DELETE op failed; oid %s not found' % deleteItem)
Exception: DELETE op failed; oid 00x not found
我的贴纸配置是:
[app:main]
use = egg:myegg
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = es
couchdb.uri = http://couchdb-host:5984/
couchdb.db = myegg
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
# Begin logging configuration
[loggers]
keys = root
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[handler_console]
class = StreamHandler
args = [sys.stdout]
level = DEBUG
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
# End logging configuration
答案 0 :(得分:0)
您是否可以使用Exception View来捕获任何异常,并在响应中返回堆栈跟踪?我已经使用了类似的东西来捕获我的所有金字塔异常,记录它们,然后向用户显示一个友好的"错误页面渲染器。