Ejemplo n.º 1
0
def register_additional_extensions(app):
    """Register additional Flask extensions"""
    CORS(app)
    db.init_app(app)
    migrate.init_app(app, db)
    jwt.init_app(app)
    ma.init_app(app)
Ejemplo n.º 2
0
def configure_extensions(app, cli):
    """configure flask extensions"""
    db.init_app(app)
    jwt.init_app(app)

    if cli is True:
        migrate.init_app(app, db)
Ejemplo n.º 3
0
def create_app():
    app = Flask(__name__)
    app.config.from_object(config)
    sql.init_app(app)
    ma.init_app(app)
    bcrypt.init_app(app)
    jwt.init_app(app)

    app.register_blueprint(routes.api_bp)

    return app
Ejemplo n.º 4
0
def create_app(config_filename):
    app = Flask(__name__)
    app.config.from_object(config_filename)

    DB.init_app(app)
    jwt.init_app(app)
    # Blueprints
    app.register_blueprint(users_model, url_prefix='/api/v1/')
    app.register_blueprint(products_model, url_prefix='/api/v1/')
    app.register_blueprint(orders_model, url_prefix='/api/v1/')
    return app
Ejemplo n.º 5
0
def register_extensions(app):
    """Register Flask extensions"""
    CORS(app)
    db.init_app(app)
    login_manager.init_app(app)
    mail.init_app(app)
    migrate.init_app(app, db)
    pagedown.init_app(app)
    if os.environ.get("FLASK_CONFIG") != "production":
        es = Elasticsearch([app.config["ES_URL"]])
    else:
        es = Elasticsearch(
            [app.config["ES_URL"]],
            http_auth=(app.config["ES_USERNAME"], app.config["ES_PASSWORD"]),
        )
    app.elasticsearch = es

    scrapyd = ScrapydAPI("http://localhost:6800")
    scheduler = BackgroundScheduler()
    app.scheduler = scheduler
    app.scrapy = scrapyd
    scheduler.start()
    jwt.init_app(app)