先安装pip install flask_debugtoolbar
    然后在注册文件中【这里不太理解为啥是在注册文件中写】:

    1. from controllers.index import index_page
    2. from application import app
    3. from flask_debugtoolbar import DebugToolbarExtension
    4. toolbar = DebugToolbarExtension(app)
    5. app.register_blueprint(index_page,url_prefix='/learning')

    但是报了如下的错

    1. H:\new_to_flask>python run.py runserver
    2. Traceback (most recent call last):
    3. File "run.py", line 3, in <module>
    4. from register import *
    5. File "H:\new_to_flask\register.py", line 7, in <module>
    6. toolbar = DebugToolbarExtension(app)
    7. File "C:\ProgramData\Anaconda3\lib\site-packages\flask_debugtoolbar\__init__.py", line 58, in __init__
    8. self.init_app(app)
    9. File "C:\ProgramData\Anaconda3\lib\site-packages\flask_debugtoolbar\__init__.py", line 69, in init_app
    10. "The Flask-DebugToolbar requires the 'SECRET_KEY' config "
    11. RuntimeError: The Flask-DebugToolbar requires the 'SECRET_KEY' config var to be set

    于是,在配置文件中,把SECRET_KEY设置一下,这里设置123456

    但是,我这里没能显示toolbar。有了一些警告信息:

    1. C:\ProgramData\Anaconda3\lib\site-packages\flask_debugtoolbar\__init__.py:213: UserWarning: Could not insert debug toolbar. </body> tag not found in response.
    2. warnings.warn('Could not insert debug toolbar.'

    正常情况下,应该是这样的:
    Debug工具flask_debugtoolbar - 图1