为金字塔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...