我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用flask_debugtoolbar.DebugToolbarExtension()。
def create_app(config_name=None): if not config_name: config_name = os.environ.get('FLASK_CONFIG', 'development') app = Flask(__name__, instance_relative_config=True) app.config.from_object(config[config_name]) app.config.from_pyfile('config.py') app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True from .main import main app.register_blueprint(main) csrf.init_app(app) db.init_app(app) tweepy.init_app(app) toolbar = DebugToolbarExtension(app) return app
def debug_app(app): """Add the debug toolbar extension to the application.""" app.jinja_env.undefined = jinja2.StrictUndefined try: import flask_debugtoolbar except ImportError: flask_debugtoolbar = None else: app.config['SECRET_KEY'] = 'debug-secret-key' flask_debugtoolbar.DebugToolbarExtension(app)
def register_debug(app): toolbar = DebugToolbarExtension() # Setting up the debug toolbar step1 toolbar.init_app(app) # Setting up the debug toolbar step2