本文整理匯總了Python中project.db.create_all方法的典型用法代碼示例。如果您正苦於以下問題:Python db.create_all方法的具體用法?Python db.create_all怎麽用?Python db.create_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類project.db
的用法示例。
在下文中一共展示了db.create_all方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: recreate_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def recreate_db():
db.drop_all()
db.create_all()
db.session.commit()
示例2: setUp
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def setUp(self):
db.create_all()
db.session.commit()
示例3: recreate_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def recreate_db():
"""Recreates a database."""
db.drop_all()
db.create_all()
db.session.commit()
示例4: recreate_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def recreate_db():
"""Recreates a database."""
db.reflect()
db.drop_all()
db.create_all()
db.session.commit()
示例5: setUp
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def setUp(self):
app.config['TESTING'] = True
app.config['WTF_CSRF_ENABLED'] = False
app.config['DEBUG'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/test'
self.app = app.test_client()
db.drop_all()
db.create_all()
mail.init_app(app)
self.assertEqual(app.debug, False)
示例6: create_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def create_db():
"""creates a database."""
db.create_all()
db.session.commit()
示例7: create_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def create_db():
db.drop_all()
db.create_all()
db.session.commit()
示例8: setUpClass
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def setUpClass(self):
db.create_all()
user = User(
email="test@user.com",
password="just_a_test_user",
confirmed=False
)
db.session.add(user)
db.session.commit()
示例9: create_db
# 需要導入模塊: from project import db [as 別名]
# 或者: from project.db import create_all [as 別名]
def create_db():
"""Creates the db tables."""
db.create_all()