예제 #1
0
def app():
    """Setup the PostgreSQL database instance and return the Flask application.

    Returns:
        app (object): The Flask application.

    """
    os.environ['APP_ENV'] = 'TESTING'
    app = create_app('TESTING')

    is_jenkins = bool(int(os.getenv('IS_JENKINS_TEST', '0')))
    postgres = None

    if not is_jenkins:
        postgres = PostgreSQLContainer()
        postgres.start_container()

    upgraded = False

    while not upgraded:
        try:
            with app.app_context():
                upgrade()
                upgraded = True
        except Exception as e:
            sleep(1)

    yield app

    if not is_jenkins:
        postgres.stop_container()
예제 #2
0
def client():
    """Setup the Flask application and return an instance of its test client.

    Returns:
        client (object): The Flask test client for the application.

    """
    app = create_app('TESTING')
    client = app.test_client()
    return client
예제 #3
0
def app():
    """Setup the PostgreSQL database instance and return the Flask application.

    Returns:
        app (object): The Flask application.

    """
    os.environ['APP_ENV'] = 'TESTING'
    app = create_app('TESTING')
    postgres = PostgreSQLContainer()
    postgres.start_container()
    upgraded = False

    while not upgraded:
        try:
            with app.app_context():
                upgrade()
                upgraded = True
        except Exception as e:
            sleep(1)
    yield app
    postgres.stop_container()
예제 #4
0
"""
This file implements the way to run the server from a WSGI server
"""

__author__ = "Marc Bermejo"
__credits__ = ["Marc Bermejo"]
__license__ = "GPL-3.0"
__version__ = "0.1.0"
__maintainer__ = "Marc Bermejo"
__email__ = "*****@*****.**"
__status__ = "Development"

from authserver import create_app

app = create_app(__name__, init_db_manager_values=False)
예제 #5
0
import os
from flask_script import Manager
from flask_migrate import MigrateCommand
from authserver import create_app

environment = os.getenv('APP_ENV', None)
app = application = create_app(environment)

manager = Manager(app)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()