为金字塔web框架配置python警告

pyramid_filterwarnings的Python项目详细描述


开始

这个项目的目的是提供一种配置python的通用方法 warnings.filterwarnings。 可以通过环境变量python解释器配置python警告 参数,或直接在代码中。此插件提供给金字塔应用程序 通过其配置文件配置警告级别的干净方法。

配置

在金字塔ini文件中设置金字塔过滤器警告插件,然后 配置级别。

pyramid.includes =
    pyramid_filterwarnings
    ... your other plugins ...

# configure the warning level, default is ignore
filterwarnings.action = ignore

注意

如果需要,您应该在配置的顶部设置过滤器警告 捕捉插件警告。您还应该将级别设置为 开发环境以尽快修复警告。

还可以设置category、模块和消息,并执行许多规则。

# Other optionals configurations keys
# filterwarnings.category = DeprecationWarning
# filterwarnings.module = pyramid\..*

# Add other rules
filterwarnings.1.action = once
filterwarnings.1.category = DeprecationWarning
filterwarnings.1.module = sqlalchemy\..*

filterwarnings.2.action = ignore
filterwarnings.2.module = pyramid_jinja2\.*
filterwarnings.2.message = reload_templates setting is deprecated

# and more if necessary...

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么即使我已经给出了代码中的所有权限,该代码也没有在emulator中运行?   java Android Studio正在抛出“线程中的异常”main“javax.net.ssl.SSLException:收到致命警报:协议\版本”   java中的for循环嵌套foreach语句   java读取/src/main/resources和/webinf/classes下的文件   java无法以此格式构造JSON响应   身份验证尝试从CAS secure rest api获取响应,但从java客户端获取登录页面作为响应   如何在java中使用excel从第1列和第3列获取单元格值,并将其作为键值对放入map中   在Java程序中打开Windows虚拟键盘   java有没有递归调用findMatch的方法?   java Pig脚本/命令,用于根据多个字符串筛选文件   java最小数量应匹配,应与POST匹配   java打开/关闭声音按钮不工作   Java嵌入式数据库持久性   java在方法调用时引发异常   java文本文件被覆盖而不是保存的问题   java Hibernate sql注释