python - 如何更改金字塔内部服务器错误的默认视图?
问题描述
我在金字塔文档中找到了这个但是给出了导入错误
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
解决方案
exception_view_config
在 Pyramid 1.8 中添加
推荐阅读
- android - 以编程方式检测 Android 中连接到电池(USB 或 AC 充电器)的电源连接类型
- python - 获取每月的最后一个星期日 - python
- react-native - 如何为应用程序创建文件夹,我可以在其中存储来自在线或本地存储的图像
- react-native - 如何在带有数组的动态数据上使用 i18n?
- react-native - fontFamily 'MaterialIcons' 不是系统字体,尚未通过 Font.loadAsync React Native 加载
- flutter - 即使在本地数据中,Flutter future builder 也会触发
- python - 理解重塑张量时的顺序
- python - 在 pandas groupby 对象上重新运行 agg 会修改原始数据框
- mysql - 如何返回符合 1+ 行条件的不同值?
- c++ - QQuickView 在调用 show 时显示一个空窗口