Esempio n. 1
0
def create_app(config=config[config_name]):
    """Return app object given config object."""
    app = Flask(__name__)
    CORS(app)
    app.config.from_object(config)

    # initialize error handlers
    initialize_errorhandlers(app)

    # bind app to db
    db.init_app(app)

    # import all models
    from api.models import User, Asset, AssetCategory, Attribute, Center

    # import views
    import api.views

    # initialize migration scripts
    migrate = Migrate(app, db)

    # initialize flask excel module
    init_excel(app)

    return app
Esempio n. 2
0
def create_app(config):
    app = Flask(__name__)
    app.config.from_object(config)

    app.register_blueprint(middleware_blueprint)
    app.register_blueprint(api_blueprint)

    db.init_app(app)

    from api.models import User

    migrate = Migrate(app, db)

    import api.views

    return app
Esempio n. 3
0
def create_app(config=AppConfig):
    """Return app object given config object"""

    app = Flask(__name__)
    app.config.from_object(config)
    app.url_map.strict_slashes = False
    app.register_blueprint(api_blueprint)

    # bind app to db
    db.init_app(app)

    import api.models
    import api.views

    # initialize migration scripts
    migrate = Migrate(app, db)

    return app
Esempio n. 4
0
def create_app(config):
    app = Flask(__name__)
    CORS(app)
    app.config.from_object(config)
    app.url_map.strict_slashes = False

    # error handlers
    initialize_error_handlers(app)

    # initialise JWT
    jwt = JWTManager(app)
    jwt._set_error_handler_callbacks(flask_api)

    # bind app to db
    db.init_app(app)

    # import models
    from api import models

    # import views
    from api import views

    return app
Esempio n. 5
0
def create_app(config=config.get(config_name)):
    """Return app object given config object."""
    app = Flask(__name__)
    app.config.from_object(config)
    initialize_blueprint(app)
    app.url_map.strict_slashes = False

    bcrypt.init_app(app)

    # initialize database
    db.init_app(app)
    # initialize migration app
    migrate.init_app(app, db)
    # initialize marshmallow
    from api.schema.schema import ma
    ma.init_app(app)

    # import all models
    from api.models import usermodel

    # import views
    import api.views

    return app