示例#1
0
def create_app(settings_override=None):
    """Returns the RiskManager dashboard application instance"""
    app = factory.create_app(__name__, __path__, settings_override)

    # Init assets
    assets.init_app(app)

    # Register custom error handlers
    if not app.debug:
        for e in [500, 404]:
            app.errorhandler(e)(handle_error)

    return app
示例#2
0
def create_and_setup_app(settings_override=None):
    app = factory.create_and_setup_app(__name__, __path__, settings_override)

    assets.init_app(app)

    # Error handlers
    if not app.debug:
        for e in [500, 404]:
            app.errorhandler(e)(handle_error)

    # Register custom Jinja filters
    app.jinja_env.filters['set'] = set_filter

    return app
示例#3
0
"""
    manage
    ~~~~~~
"""

import logging

from flask.ext.script import Manager
from flask.ext.assets import ManageAssets
from flask.ext.migrate import Migrate, MigrateCommand

from app.factory import create_app
from app.frontend import assets
from app.core import db

LOG_FMT = '%(levelname)s [%(name)s] %(message)s'
logging.basicConfig(format=LOG_FMT)


app = create_app(__name__)
assets = assets.init_app(app)
migrate = Migrate(app, db)

manager = Manager(app)
manager.add_command("assets", ManageAssets(assets))
manager.add_command('db', MigrateCommand)


if __name__ == "__main__":
    manager.run()