示例#1
0
def app():
    app = create_app()

    # some setup code

    ctx = app.app_context()
    ctx.push()
    yield app
    ctx.pop()
示例#2
0
def app():
    """
    Setup our flask test app, this only gets executed once.

    :return: Flask app
    """
    db_uri = '{0}_test'.format(settings.SQLALCHEMY_DATABASE_URI)
    params = {
        'DEBUG': False,
        'TESTING': True,
        'WTF_CSRF_ENABLED': False,
        'SQLALCHEMY_DATABASE_URI': db_uri
    }

    _app = create_app(settings_override=params)

    # Establish an application context before running the tests.
    ctx = _app.app_context()
    ctx.push()

    yield _app

    ctx.pop()
示例#3
0
from __future__ import with_statement

import os
import sys
from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config

from App.app import create_app
from App.extensions import db

app = create_app()

# Include the project's folder on the system path.
sys.path.append(os.getcwd())

# Provides access to the values within the alembic.ini file.
config = context.config

# Configure logging.
fileConfig(config.config_file_name)

# Get the SQLAlchemy database URI.
config.set_main_option('sqlalchemy.url', app.config['SQLALCHEMY_DATABASE_URI'])

# Required for --autogenerate to work so that Alembic can attempt to find
# the difference between the current database and our models automatically.
target_metadata = db.metadata