首页 > 解决方案 > 如何更改金字塔内部服务器错误的默认视图?

问题描述

我在金字塔文档中找到了这个但是给出了导入错误

from pyramid.view import exception_view_config

@exception_view_config()
def internal_error(request):
    response =  Response('Internal error')
    response.status_int = 500
    return response

编辑:使用 python2.7 和金字塔 1.7.2 它给出

ImportError: cannot import name exception_view_config 

标签: pythonpyramid

解决方案


exception_view_config在 Pyramid 1.8 中添加


推荐阅读