Correctly initialize debug toolbar

master
Steven Loria 11 years ago
parent 6303991a69
commit 338ef8b280
  1. 2
      {{cookiecutter.app_name}}/requirements/dev.txt
  2. 10
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/app.py
  3. 3
      {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py

@ -9,4 +9,4 @@ factory-boy>=2.2.1
Flask-Script Flask-Script
# Debug toolbar # Debug toolbar
Flask-DebugToolbar Flask-DebugToolbar==0.9.0

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
'''The app module, containing the app factory function.''' '''The app module, containing the app factory function.'''
from flask import Flask, render_template from flask import Flask, render_template
from flask_debugtoolbar import DebugToolbarExtension
from {{cookiecutter.app_name}}.settings import ProdConfig from {{cookiecutter.app_name}}.settings import ProdConfig
from {{cookiecutter.app_name}}.assets import assets from {{cookiecutter.app_name}}.assets import assets
@ -11,6 +10,7 @@ from {{cookiecutter.app_name}}.extensions import (
db, db,
login_manager, login_manager,
migrate, migrate,
debug_toolbar,
) )
from {{cookiecutter.app_name}} import public, user from {{cookiecutter.app_name}} import public, user
@ -30,13 +30,13 @@ def create_app(config_object=ProdConfig):
def register_extensions(app): def register_extensions(app):
db.init_app(app)
login_manager.init_app(app)
assets.init_app(app) assets.init_app(app)
toolbar = DebugToolbarExtension(app) bcrypt.init_app(app)
cache.init_app(app) cache.init_app(app)
db.init_app(app)
login_manager.init_app(app)
debug_toolbar.init_app(app)
migrate.init_app(app, db) migrate.init_app(app, db)
bcrypt.init_app(app)
return None return None

@ -17,3 +17,6 @@ migrate = Migrate()
from flask.ext.cache import Cache from flask.ext.cache import Cache
cache = Cache() cache = Cache()
from flask.ext.debugtoolbar import DebugToolbarExtension
debug_toolbar = DebugToolbarExtension()

Loading…
Cancel
Save