コード例 #1
0
ファイル: _base.py プロジェクト: valley51/zerqu
    def setUp(self):
        app = create_app({
            'SQLALCHEMY_DATABASE_URI': DATABASE,
            'ZERQU_CACHE_TYPE': 'simple',
            'OAUTH_CACHE_TYPE': 'simple',
            'RATE_LIMITER_TYPE': 'cache',
            'SECRET_KEY': 'secret',
        })
        app.testing = True

        register_base(app)

        self._ctx = app.app_context()
        self._ctx.push()

        db.drop_all()
        db.create_all()
        self.app = app
        self.client = app.test_client()
コード例 #2
0
ファイル: env.py プロジェクト: 343829084/zerqu
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add zerqu root to sys.path
cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, cwd)

from zerqu.app import create_app
from zerqu.models import db

app = create_app()
db.init_app(app)

config.set_main_option(
    'sqlalchemy.url', app.config.get('SQLALCHEMY_DATABASE_URI')
)
target_metadata = db.metadata


def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.
コード例 #3
0
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add zerqu root to sys.path
cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, cwd)

from zerqu.app import create_app
from zerqu.models import db

app = create_app()
db.init_app(app)

config.set_main_option('sqlalchemy.url',
                       app.config.get('SQLALCHEMY_DATABASE_URI'))
target_metadata = db.metadata


def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.