server.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:functest 作者: opnfv 项目源码 文件源码
def init_db():
    """
    Import all modules here that might define models so that
    they will be registered properly on the metadata, and then
    create a database
    """
    def func(subcls):
        """ To check the subclasses of BASE"""
        try:
            if issubclass(subcls[1], BASE):
                return True
        except TypeError:
            pass
        return False
    # pylint: disable=bad-builtin
    subclses = filter(func, inspect.getmembers(models, inspect.isclass))
    LOGGER.debug('Import models: %s', [subcls[1] for subcls in subclses])
    BASE.metadata.create_all(bind=ENGINE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号