def create_db(config): set_config(config) from recastfrontend.server import app with app.app_context(): from recastfrontend.server import db db.create_all() click.secho('created database at: {}'.format(db.engine.url), fg = 'green')
def create_db(config): if config: os.environ['RECASTCONTROLCENTER_CONFIG'] = config from recastfrontend.server import app with app.app_context(): from recastfrontend.server import db db.create_all() click.secho('created database at: {}'.format(db.engine.url), fg = 'green')
def setUp(self): self.app = create_app() self.app.testing = True self.app_context = self.app.app_context() self.app_context.push() with self.app.app_context(): db.create_all() self.client = self.app.test_client()
# -*- coding: utf-8 -*- import recastdb.models as models from flask import Flask from frontendconfig import config as frontendconf import uuid from recastfrontend.server import app with app.app_context(): from recastfrontend.server import db db.create_all() app.app_context().push() user1 = models.User( name='Christian Bora', email='*****@*****.**' ) db.session.add(user1) db.session.commit() user2 = models.User( name='Admin', email='admin@recast', orcid_id = 'example123' ) db.session.add(user2) db.session.commit() token = models.AccessToken(