示例#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
        self._ctx = app.app_context()
        self._ctx.push()

        db.init_app(app)

        db.drop_all()
        db.create_all()

        self.app = app
        self.client = app.test_client()
        self.prepare_data()
示例#2
0
    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
        self._ctx = app.app_context()
        self._ctx.push()

        db.init_app(app)

        db.drop_all()
        db.create_all()

        self.app = app
        self.client = app.test_client()
        self.prepare_data()
示例#3
0
文件: env.py 项目: 343829084/zerqu
# 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.
示例#4
0
# 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.

    Calls to context.execute() here emit the given string to the