Exemple #1
0
def register_extensions(app):
    """Register Flask extensions."""
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    cors.init_app(app)
    login_manager.init_app(app)
    migrate.init_app(app, db)
    rd.init_app(app)
    celery.conf.update(app.config)
Exemple #2
0
def register_extensions(app):
    """Register Flask extensions"""
    CORS(app)
    db.init_app(app)
    login_manager.init_app(app)
    mail.init_app(app)
    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()
Exemple #3
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)
    swag = Swagger(app)  # noqa: F841
    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)