本文整理汇总了Python中app.db.drop_all方法的典型用法代码示例。如果您正苦于以下问题:Python db.drop_all方法的具体用法?Python db.drop_all怎么用?Python db.drop_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.db
的用法示例。
在下文中一共展示了db.drop_all方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def setUpClass(cls):
# start Firefox
try:
cls.client = webdriver.Firefox()
except:
pass
if cls.client:
cls.app = create_app('testing')
cls.app_context = cls.app.app_context()
cls.app_context.push()
db.drop_all()
db.create_all()
todo = Todo(title='title1', body='body1')
db.session.add(todo)
db.session.commit()
threading.Thread(target=cls.app.run).start()
示例2: tearDown
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def tearDown(self):
db.session.remove()
db.drop_all()
self.app_context.pop()
示例3: tearDownClass
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def tearDownClass(cls):
if cls.client:
# stop the flask server and the browser
cls.client.get('http://localhost:5000/shutdown')
cls.client.close()
# destroy database
db.drop_all()
db.session.remove()
# remove application context
cls.app_context.pop()
示例4: setUp
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def setUp(self):
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
app.config['DEBUG'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
self.app = app.test_client()
db.drop_all()
db.create_all()
示例5: teardown_class
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def teardown_class(cls):
"""Delete the database created for testing"""
db.session.remove()
db.drop_all()
示例6: tearDown
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def tearDown(self):
"""Destroy blank temp database after each test"""
db.drop_all()
示例7: tearDown
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def tearDown(self):
db.session.remove()
db.drop_all()
示例8: __init__
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def __init__(self):
# in case the tables haven't been created already
db.drop_all()
db.create_all()
示例9: db
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def db(flask_app):
"""Set up the database as a session-wide fixture."""
db_.app = flask_app
db_.drop_all()
db_.create_all()
yield db_
示例10: init_db
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def init_db():
""" Initialize the database."""
db.drop_all()
db.create_all()
create_users()
示例11: tearDownClass
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def tearDownClass(cls):
db.session.remove()
db.drop_all()
示例12: dropdb
# 需要导入模块: from app import db [as 别名]
# 或者: from app.db import drop_all [as 别名]
def dropdb():
if prompt_bool(
'Are you sure you want to lose all your data'):
db.drop_all()