Exemplo n.º 1
0
    def action_db_migrate(action=('a', 'start'), debug=False):
        """Migrate database.
        This command is responsible for data base migrations.
        Actions:
        init - initiates migration module use only once.
        migrate - creates schema migration.
        upgrade - upgrades database using schema migrations.

        Options:
        - '--debug' use debug configuration
        """
        from flask.ext.migrate import upgrade, init, migrate, stamp, downgrade
        if debug:
            app = make_debug(with_debug_layer=False)
        else:
            app = make_app()

        with app.app_context():
            if action == 'init':
                init()
            elif action == 'migrate':
                migrate()
            elif action == 'upgrade':
                upgrade()
            elif action == 'stamp':
                stamp()
            elif action == 'downgrade':
                downgrade()
            else:
                print('Unknown action')
Exemplo n.º 2
0
    def action_db_migrate(action=('a', 'start'), debug=False):
        """Migrate database.
        This command is responsible for data base migrations.
        Actions:
        init - initiates migration module use only once.
        migrate - creates schema migration.
        upgrade - upgrades database using schema migrations.

        Options:
        - '--debug' use debug configuration
        """
        from flask.ext.migrate import upgrade, init, migrate, stamp, downgrade
        if debug:
            app = make_debug(with_debug_layer=False)
        else:
            app = make_app()

        with app.app_context():
            if action == 'init':
                init()
            elif action == 'migrate':
                migrate()
            elif action == 'upgrade':
                upgrade()
            elif action == 'stamp':
                stamp()
            elif action == 'downgrade':
                downgrade()
            else:
                print('Unknown action')
Exemplo n.º 3
0
def make_app(global_cfg=None, cfg=DEPLOY_CFG, log_cfg=DEPLOY_INI, debug=False):
    """
    Create and configure Flask app.
    """
    global_cfg = {} if global_cfg is None else global_cfg
    fileConfig(log_cfg)
    from lunch_app.main import app, init
    app.config.from_pyfile(abspath(cfg))
    app.debug = debug
    init()
    return app
Exemplo n.º 4
0
def make_app(global_cfg=None, cfg=DEPLOY_CFG, log_cfg=DEPLOY_INI, debug=False):
    """
    Create and configure Flask app.
    """
    global_cfg = {} if global_cfg is None else global_cfg
    fileConfig(log_cfg)
    from lunch_app.main import app, init
    app.config.from_pyfile(abspath(cfg))
    app.debug = debug
    init()
    return app