我希望Web2py只返回错误屏幕/堆栈跟踪...我不想要这个售票系统。我怎么才能把它关掉?
发布于 2010-06-11 11:25:27
你不能。如果您以管理员身份登录并单击票证编号,则会打开一个包含堆栈跟踪的窗口。您可以在routes.py中使用routes_onerror向用户显示不同的错误页面,并在不希望公开票证编号时隐藏票证编号。
发布于 2018-08-04 02:12:42
在我们的Web2py生产环境中,我通过执行以下操作向最终用户隐藏票证:
1)在模型(db.py)中,我测试我是否在生产环境中,如果在生产环境中,我向用户的请求添加一个名为hide_ticket的变量:
# The is_production variable is read from an environment variable earlier.
if settings.is_production:
request.hide_ticket = True2)然后将gluon/main.py修改为:
if request.hide_ticket:
http_response = \
HTTP(500, '<html><body><h1>Request Failed</body></h1></html><!--- IE Needs this' + ('x' * 512) + '--->' )
else:
http_response = \
HTTP(500, rwthread.routes.error_message_ticket %
dict(ticket=ticket),
web2py_error='ticket %s' % ticket)而不是这样:
http_response = \
HTTP(500, rwthread.routes.error_message_ticket %
dict(ticket=ticket),
web2py_error='ticket %s' % ticket)https://stackoverflow.com/questions/3019401
复制相似问题