def create_app(config={}):
    app = Flask("chassis")
    app.config.from_envvar("FLASK_CONFIG")
    app.config.update(config)

    #External
    sentry.init_app(app)
    api.init_app(app)
    cache.init_app(app)

    #Internal
    db.init_app(app)

    #API Endpoints
    api.add_resource(CatAPI, "/cats/<int:cat_id>")
    api.add_resource(TodoListAPI, "/todos")

    app.add_url_rule("/", view_func=show_todos)

    with app.app_context():
        db.create_all()

    #Debug tools
    if app.debug:
        DebugToolbarExtension(app)
        if app.config.get("PROFILE", False):
            app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
                                              restrictions=[30],
                                              sort_by=("time", "cumulative"))

    return app
def create_app(config={}):
    app = Flask("chassis")
    app.config.from_envvar("FLASK_CONFIG")
    app.config.update(config)

    #External
    sentry.init_app(app)
    api.init_app(app)
    cache.init_app(app)

    #Internal
    db.init_app(app)

    #API Endpoints
    api.add_resource(CatAPI, "/cats/<int:cat_id>")

    with app.app_context():
        db.create_all()

    #Debug tools
    if app.debug:
        DebugToolbarExtension(app)
        if app.config.get("PROFILE", False):
            app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
                                              restrictions=[30],
                                              sort_by=("time", "cumulative"))

    return app
Example #3
0
 def setUp(self):
     db.create_all()
Example #4
0
 def setUp(self):
     db.create_all()