util.py 文件源码

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

项目:micromasters 作者: mitodl 项目源码 文件源码
def __init__(self, db_settings=None, db_backup_name=None):
        """
        Constructor

        Args:
            db_settings (dict): A dict of database settings
            db_backup_name (str): The name that will be given to the backup database
        """
        self.db_settings = db_settings or settings.DATABASES['default']
        self.db_name = self.db_settings['NAME']
        if self.db_name[0:5] != 'test_':
            raise Exception(
                "The test suite is attempting to use the database '{}'."
                "The test database should have a name that begins with 'test_'. Exiting...".format(self.db_name)
            )
        self.db_backup_name = db_backup_name or getattr(settings, 'BACKUP_DB_NAME', self.DEFAULT_BACKUP_DB_NAME)
        self.db_cmd_args = [
            "-h", self.db_settings['HOST'],
            "-p", str(self.db_settings['PORT']),
            "-U", self.db_settings['USER']
        ]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号