コード例 #1
0
def client(app):
    db.create_all()
    link1 = Link(id='example1', url='http://example1.com')
    link2 = Link(id='example2', url='http://example2.com')
    db.session.add_all([link1, link2])
    db.session.commit()
    yield app.test_client()
    db.session.remove()
    db.drop_all()
コード例 #2
0
ファイル: tools.py プロジェクト: zhaoyuji/url_shortener
def recreate_db():
    db.drop_all()
    db.create_all()
コード例 #3
0
 def run(self):
     from url_shortener import db
     # db.drop_all()
     db.create_all()
     db.session.commit()
コード例 #4
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     self.client = self.app.test_client(use_cookies=False)
コード例 #5
0
ファイル: tools.py プロジェクト: ruzhytskyi/url_shortener
def recreate_db():
    db.drop_all()
    db.create_all()
コード例 #6
0
def deploy():
    from flask_migrate import upgrade
    upgrade()
    db.create_all()
コード例 #7
0
ファイル: commands.py プロジェクト: antlu/url-shortener
def init_db_command():
    """Create database tables."""
    db.create_all()
コード例 #8
0
 def setUp(self):
     self.db_fd, self.db_fn = tempfile.mkstemp()
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + self.db_fn 
     app.config['TESTING'] = True
     self.app = app.test_client()
     db.create_all()