masonite关于debugger

qiudaozhang

qiudaozhang

Posted on June 11, 2022

masonite关于debugger

安装

pip install masonite-debugbar
Enter fullscreen mode Exit fullscreen mode

使用

config/providers.py 文件修改

from debugbar.providers import DebugProvider
PROVIDERS = [
    ....
    DebugProvider
]

Enter fullscreen mode Exit fullscreen mode

不过上线的时候也这样就不好了,会暴露敏感信息,所以改造一下

from debugbar.providers import DebugProvider

# 如果不是生产环境,不要开启debug,即便安装了插件,也不会暴露敏感信息
if (env("APP_ENV") != 'prod'):
    PROVIDERS.append(DebugProvider)
Enter fullscreen mode Exit fullscreen mode

这样即便打开了这个工具,也看不到信息

效果1

💖 💪 🙅 🚩
qiudaozhang
qiudaozhang

Posted on June 11, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related