全局检查django错误报告中的一组默认变量名
django-extra-sensitive-variables的Python项目详细描述
extra_sensitive_variables是django的第三方异常筛选器。这样你就可以 全局审查django错误报告中的一组默认变量名,而不考虑函数的 缺少@sensitive_*decorators。基本上,任何与 settings.EXTRA_SENSITIVE_VARIABLES或settings.EXTRA_SENSITIVE_POST_PARAMETERS将被审查。
安装
通过pip安装软件包
pip install django-extra-sensitive-variables
告诉django通过重写^{tt5}来使用额外敏感变量筛选器$ 在您的settings.py
DEFAULT_EXCEPTION_REPORTER_FILTER = 'extra_sensitive_variables.ExtraSensitiveReporterFilter'
然后将以下变量添加到settings.py中,并根据需要进行修改
# Variable names to always censor from "local vars" output EXTRA_SENSITIVE_VARIABLES = ['password', 'credentials'] # Censor anything from the POST QueryDict matching these names EXTRA_SENSITIVE_POST_PARAMETERS = ['password', 'credentials', 'credit_card_number']