当前位置: 首页>>代码示例>>Python>>正文


Python db.create_all方法代码示例

本文整理汇总了Python中model.db.create_all方法的典型用法代码示例。如果您正苦于以下问题:Python db.create_all方法的具体用法?Python db.create_all怎么用?Python db.create_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.db的用法示例。


在下文中一共展示了db.create_all方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        """To do before every test"""

        self.client = app.test_client()
        app.config['SECRET_KEY'] = '123'
        app.config['TESTING'] = True

        # connect to test database
        connect_to_db(app, "postgresql:///testdb")

        """Creates tables and adds example data to testdb"""
        db.create_all()
        example_data()

        with self.client as c:
            with c.session_transaction() as sess:
                sess['user'] = 1 
开发者ID:kjlundsgaard,项目名称:hb-final-project,代码行数:19,代码来源:tests.py

示例2: __init__

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def __init__(self):
        # create database
        try:
            ApplyMsg.query.all()
        except:
            db.create_all()

    # user apply for beans 
开发者ID:unias,项目名称:docklet,代码行数:10,代码来源:beansapplicationmgr.py

示例3: __init__

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def __init__(self):
        logger.info("Notification Manager init...")
        try:
            Notification.query.all()
        except:
            db.create_all()
        try:
            NotificationGroups.query.all()
        except:
            db.create_all()
        try:
            UserNotificationPair.query.all()
        except:
            db.create_all()
        logger.info("Notification Manager init done!") 
开发者ID:unias,项目名称:docklet,代码行数:17,代码来源:notificationmgr.py

示例4: __init__

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def __init__(self):
        try:
            VNode.query.all()
            History.query.all()
        except:
            db.create_all(bind='__all__') 
开发者ID:unias,项目名称:docklet,代码行数:8,代码来源:monitor.py

示例5: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        """Stuff to do before every test."""

        # Get the Flask test client
        self.client = app.test_client()

        # Create secret key to access session
        app.secret_key = "ABC"

        # Connect to fake database
        connect_to_db(app, 'postgresql:///testdb')
        db.create_all()
        app.config['TESTING'] = True

        example_data() 
开发者ID:EmmaOnThursday,项目名称:next-book,代码行数:17,代码来源:tests.py

示例6: create_sql

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def create_sql(db):
    db.create_all() 
开发者ID:rui7157,项目名称:Flask-NvRay-Blog,代码行数:4,代码来源:__init__.py

示例7: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        """Before tests."""

        self.client = app.test_client()
        app.config['TESTING'] = True
        # Connect to test database
        connect_to_db(app, "postgresql:///testdb")

        # Create tables and add sample data
        db.create_all()
        example_data() 
开发者ID:Gerdie,项目名称:farm-to-front-door,代码行数:13,代码来源:tests.py

示例8: clean_db

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def clean_db():

    # In case tables haven't been created, create them
    db.session.commit()
    db.drop_all()
    db.create_all() 
开发者ID:elsabirch,项目名称:gallery-wall,代码行数:8,代码来源:seed_database.py

示例9: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        self.client = app.test_client()
        app.config['TESTING'] = True

        #Connect to test db
        connect_to_db(app, 'postgresql:///testdb')

        #Create tables & add sample data
        db.create_all()
        example_data() 
开发者ID:k-wiz,项目名称:insomnia-app,代码行数:12,代码来源:tests.py

示例10: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        """ Stuff to do before every test """

        app.config['TESTING'] = True
        app.config['SECRET_KEY'] = 'key123'
        self.client = app.test_client()

        # Connect to test database (uncomment when testing database)
        connect_to_db(app, "postgresql:///testdb")

        # Create tables and add sample data (uncomment when testing database)
        db.create_all()
        example_data() 
开发者ID:emilydowgialo,项目名称:Spent,代码行数:15,代码来源:tests.py

示例11: setUp

# 需要导入模块: from model import db [as 别名]
# 或者: from model.db import create_all [as 别名]
def setUp(self):
        self.client = app.test_client()
        app.config['TESTING'] = True

        # Connect to test database
        connect_to_db(app, "postgresql:///cals_test")
        print "Built test db"

        # Create tables and seed sample data
        db.create_all()
        test_data() 
开发者ID:maheskett,项目名称:Calendar-Analytics,代码行数:13,代码来源:tests.py


注:本文中的model.db.create_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。