本文整理匯總了Python中paste.deploy.loadwsgi.SERVER屬性的典型用法代碼示例。如果您正苦於以下問題:Python loadwsgi.SERVER屬性的具體用法?Python loadwsgi.SERVER怎麽用?Python loadwsgi.SERVER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類paste.deploy.loadwsgi
的用法示例。
在下文中一共展示了loadwsgi.SERVER屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: paste_config
# 需要導入模塊: from paste.deploy import loadwsgi [as 別名]
# 或者: from paste.deploy.loadwsgi import SERVER [as 別名]
def paste_config(gconfig, config_url, relative_to, global_conf=None):
# add entry to pkg_resources
sys.path.insert(0, relative_to)
pkg_resources.working_set.add_entry(relative_to)
config_url = config_url.split('#')[0]
cx = loadwsgi.loadcontext(SERVER, config_url, relative_to=relative_to,
global_conf=global_conf)
gc, lc = cx.global_conf.copy(), cx.local_conf.copy()
cfg = {}
host, port = lc.pop('host', ''), lc.pop('port', '')
if host and port:
cfg['bind'] = '%s:%s' % (host, port)
elif host:
cfg['bind'] = host.split(',')
cfg['default_proc_name'] = gc.get('__file__')
# init logging configuration
config_file = config_url.split(':')[1]
if _has_logging_config(config_file):
cfg.setdefault('logconfig', config_file)
for k, v in gc.items():
if k not in gconfig.settings:
continue
cfg[k] = v
for k, v in lc.items():
if k not in gconfig.settings:
continue
cfg[k] = v
return cfg