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


Python settings.get方法代码示例

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


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

示例1: get_db_engine

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def get_db_engine(db_key):
    databases = settings.get('databases', 0)
    db_conf = databases[db_key]
    dbuser = db_conf['user']
    dbpwd = db_conf['pwd']
    dbhost = db_conf['host']
    dbport = db_conf.get('port', 0)
    dbname = db_conf['name']
    return create_engine('mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'
                         .format(user=dbuser, pwd=quote_plus(dbpwd), host=dbhost, port=dbport, dbname=dbname),
                         logging_name=db_key, pool_pre_ping=True) #pool_size=10  poolclass=NullPool, pool_recycle=60 
开发者ID:opendevops-cn,项目名称:codo-tools,代码行数:13,代码来源:db_context.py

示例2: post

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def post(self, *args, **kwargs):
        data = json.loads(self.request.body.decode("utf-8"))
        user_id = data.get('user_id', None)
        secret_key = data.get('secret_key', None)
        is_superuser = data.get('is_superuser', False)
        if secret_key != my_settings.get('secret_key'):
            return self.write(dict(code=-1, msg='secret key error'))

        if not user_id:
            return self.write(dict(code=-2, msg='auth failed'))

        else:
            my_verify = MyVerify(str(user_id), is_superuser)
            my_verify.write_verify()
        return self.write(dict(code=0, msg='缓存成功')) 
开发者ID:opendevops-cn,项目名称:codo-admin,代码行数:17,代码来源:verify_handler.py

示例3: get_db_engine

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def get_db_engine(db_key):
    databases = settings.get('databases', 0)
    db_conf = databases[db_key]
    dbuser = db_conf['user']
    dbpwd = db_conf['pwd']
    dbhost = db_conf['host']
    dbport = db_conf.get('port', 0)
    dbname = db_conf['name']
    return create_engine('mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'
                         .format(user=dbuser, pwd=quote_plus(dbpwd), host=dbhost, port=dbport, dbname=dbname),
                         logging_name=db_key, pool_size=10) 
开发者ID:opendevops-cn,项目名称:codo-task,代码行数:13,代码来源:db_context.py

示例4: setUpClass

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def setUpClass(cls):
        client_id = settings.get('client_credentials').get('client_id')
        username = settings.get('user_credentials').get('username')
        password = settings.get('user_credentials').get('password')
        cls.client = OutlookClient.from_tenant(settings.get('tenant'))\
            .with_user_credentials(client_id, username, password) 
开发者ID:vgrem,项目名称:Office365-REST-Python-Client,代码行数:8,代码来源:outlook_case.py

示例5: test1_connect_with_app_principal

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def test1_connect_with_app_principal(self):
        credentials = ClientCredential(settings.get('client_credentials').get('client_id'),
                                       settings.get('client_credentials').get('client_secret'))
        ctx = ClientContext.connect_with_credentials(settings['url'], credentials)
        self.assertIsInstance(ctx.authentication_context.provider, ACSTokenProvider)
        self.assertIsInstance(ctx.authentication_context.provider.token, TokenResponse)
        self.assertTrue(ctx.authentication_context.provider.token.is_valid) 
开发者ID:vgrem,项目名称:Office365-REST-Python-Client,代码行数:9,代码来源:test_sharepoint_client.py

示例6: get_db_url

# 需要导入模块: from settings import settings [as 别名]
# 或者: from settings.settings import get [as 别名]
def get_db_url(dbkey):
    databases = settings.get('databases', 0)
    db_conf = databases[dbkey]
    dbuser = db_conf['user']
    dbpwd = db_conf['pwd']
    dbhost = db_conf['host']
    dbport = db_conf.get('port', 3306)
    dbname = db_conf['name']

    return 'mysql+pymysql://{user}:{pwd}@{host}:{port}/{dbname}?charset=utf8'.format(user=dbuser, pwd=quote_plus(dbpwd),
                                                                                     host=dbhost, port=dbport,
                                                                                     dbname=dbname, poolclass=NullPool) 
开发者ID:opendevops-cn,项目名称:codo-cron,代码行数:14,代码来源:db_context.py


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