示例#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
    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
文件: app.py 项目: valley51/zerqu
def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()
示例#4
0
文件: app.py 项目: valley51/zerqu
    formatter = logging.Formatter(
        '[%(levelname)s %(funcName)s %(filename)s:%(lineno)d]: %(message)s')
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(formatter)

    log = logging.getLogger('flask_oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    log = logging.getLogger('oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)


def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()


if '--initdb' in sys.argv:
    create_database()
    sys.exit()

with app.app_context():
    db.create_all()

app.run(host='0.0.0.0')
示例#5
0
文件: app.py 项目: 343829084/zerqu
def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()
示例#6
0
文件: app.py 项目: 343829084/zerqu
    )
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(formatter)

    log = logging.getLogger('flask_oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)

    log = logging.getLogger('oauthlib')
    log.addHandler(handler)
    log.setLevel(logging.DEBUG)


def create_database():
    import fixtures
    with app.app_context():
        db.drop_all()
        db.create_all()
        fixtures.run()


if '--initdb' in sys.argv:
    create_database()
    sys.exit()


with app.app_context():
    db.create_all()

app.run(host='0.0.0.0')