コード例 #1
0
ファイル: worker.py プロジェクト: getredash/redash
def init_celery_flask_app(**kwargs):
    """Create the Flask app after forking a new worker.

    This is to make sure no resources are shared between processes.
    """
    app = create_app()
    app.app_context().push()
コード例 #2
0
ファイル: __init__.py プロジェクト: ariarijp/redash
def create(group):
    app = current_app or create_app()
    group.app = app

    @app.shell_context_processor
    def shell_context():
        from redash import models
        return dict(models=models)

    return app
コード例 #3
0
ファイル: __init__.py プロジェクト: ezioavi42/redash
 def setUp(self):
     self.app = create_app()
     self.db = db
     self.app.config['TESTING'] = True
     self.app_ctx = self.app.app_context()
     self.app_ctx.push()
     db.session.close()
     db.drop_all()
     db.create_all()
     self.factory = Factory()
     self.client = self.app.test_client()
コード例 #4
0
 def setUp(self):
     self.app = create_app()
     self.db = db
     self.app.config['TESTING'] = True
     self.app.config['SERVER_NAME'] = 'localhost'
     self.app_ctx = self.app.app_context()
     self.app_ctx.push()
     db.session.close()
     db.drop_all()
     db.create_all()
     self.factory = Factory()
     self.client = self.app.test_client()
コード例 #5
0
ファイル: __init__.py プロジェクト: getredash/redash
def create(group):
    app = current_app or create_app()
    group.app = app

    @app.shell_context_processor
    def shell_context():
        from redash import models, settings
        return {
            'models': models,
            'settings': settings,
        }
    return app
コード例 #6
0
ファイル: __init__.py プロジェクト: zuoxiaolei/redash
def create(group):
    app = current_app or create_app()
    group.app = app

    @app.shell_context_processor
    def shell_context():
        from redash import models, settings
        return {
            'models': models,
            'settings': settings,
        }
    return app
コード例 #7
0
ファイル: test_utils.py プロジェクト: yejian9237/redash
 def test_render(self):
     app = create_app()
     with app.app_context():
         d = {
             "failures": [{
                 "id": 1,
                 "name": "Failure Unit Test",
                 "failed_at": "May 04, 2021 02:07PM UTC",
                 "failure_reason": "",
                 "failure_count": 1,
                 "comment": None
             }]
         }
         html, text = [
             render_template("emails/failures.{}".format(f), d)
             for f in ["html", "txt"]
         ]
         self.assertIn('Failure Unit Test', html)
         self.assertIn('Failure Unit Test', text)
コード例 #8
0
def init_celery_flask_app(**kwargs):
    app = create_app()
    app.app_context().push()
コード例 #9
0
ファイル: wsgi.py プロジェクト: www3838438/docker-redash
# -*- coding: utf-8 -*-
from redash import create_app

app = create_app()
コード例 #10
0
ファイル: worker.py プロジェクト: Captricity/redash
def init_celery_flask_app(**kwargs):
    app = create_app()
    app.app_context().push()
コード例 #11
0
ファイル: worker.py プロジェクト: jonyboy2000/redash
def add_periodic_tasks(sender, **kwargs):
    app = create_app()
    periodic_tasks = getattr(app, 'periodic_tasks', {})
    for params in periodic_tasks.values():
        sender.add_periodic_task(**params)
コード例 #12
0
 def __call__(self, *args, **kwargs):
     app = create_app()
     with app.app_context():
         return TaskBase.__call__(self, *args, **kwargs)
コード例 #13
0
ファイル: wsgi.py プロジェクト: jmvasquez/redashtest
from redash import create_app

app = create_app()

コード例 #14
0
ファイル: worker.py プロジェクト: tdsmith/redash
def add_periodic_tasks(sender, **kwargs):
    app = create_app()
    periodic_tasks = getattr(app, 'periodic_tasks', {})
    for params in periodic_tasks.values():
        sender.add_periodic_task(**params)
コード例 #15
0
ファイル: base.py プロジェクト: zhuixinjian/redash
 def __call__(self, *args, **kwargs):
     if not has_app_context():
         flask_app = current_app or create_app()
         self.app_ctx = flask_app.app_context()
         self.app_ctx.push()
     return super(BaseTask, self).__call__(*args, **kwargs)
コード例 #16
0
def create(group):
    app = create_app()
    group.app = app
    return app