コード例 #1
0
def create_megaqc_app():
    from megaqc.app import create_app
    from megaqc.settings import DevConfig, ProdConfig, TestConfig

    if env.bool("FLASK_DEBUG", False):
        CONFIG = DevConfig()
    elif env.bool("MEGAQC_PRODUCTION", False):
        CONFIG = ProdConfig()
    else:
        CONFIG = TestConfig()

    if settings.run_db_check:
        # Attempt to connect to the database exists to check that it exists
        try:
            dbengine = sqlalchemy.create_engine(
                CONFIG.SQLALCHEMY_DATABASE_URI).connect()
            metadata = sqlalchemy.MetaData(dbengine, reflect=True)
            assert "sample_data" in metadata.tables
        except:
            print(
                "\n##### ERROR! Could not find table 'sample_data' in database!"
            )
            print(
                "Has the database been initialised? If not, please run 'megaqc initdb' first"
            )
            print("Exiting...\n")
            sys.exit(1)
        else:
            dbengine.close()

    return create_app(CONFIG)
コード例 #2
0
def create_megaqc_app(info):
    import os
    from megaqc.app import create_app
    from megaqc.settings import TestConfig, DevConfig, ProdConfig

    if os.environ.get("FLASK_DEBUG", False):
        CONFIG = DevConfig()
    elif os.environ.get("MEGAQC_PRODUCTION", False):
        CONFIG = ProdConfig()
    else:
        CONFIG = TestConfig()
    return create_app(CONFIG)
コード例 #3
0
ファイル: wsgi.py プロジェクト: hydrolyzedmaltose/MegaQC
import os
from megaqc.app import create_app
from megaqc.settings import TestConfig, DevConfig, ProdConfig

CONFIG = TestConfig()
if os.environ.get('MEGAQC_DEBUG', False):
    CONFIG = DevConfig()
elif os.environ.get('MEGAQC_PRODUCTION', False):
    CONFIG = ProdConfig()

app = create_app(CONFIG)