本文整理汇总了Python中gunicorn.config.make_settings方法的典型用法代码示例。如果您正苦于以下问题:Python config.make_settings方法的具体用法?Python config.make_settings怎么用?Python config.make_settings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gunicorn.config
的用法示例。
在下文中一共展示了config.make_settings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_options
# 需要导入模块: from gunicorn import config [as 别名]
# 或者: from gunicorn.config import make_settings [as 别名]
def get_options(self):
options = []
try:
from gunicorn.config import make_settings
except ImportError:
# Gunicorn does not yet support Windows.
# See issue #524. https://github.com/benoitc/gunicorn/issues/524
# For dev on Windows, make this an optional import.
print('Could not import gunicorn, skipping.')
return options
settings = make_settings()
for setting, klass in settings.items():
if klass.cli:
if klass.action:
if klass.action == 'store_const':
options.append(Option(*klass.cli, const=klass.const, action=klass.action))
else:
options.append(Option(*klass.cli, action=klass.action))
else:
options.append(Option(*klass.cli))
return options
示例2: make_options
# 需要导入模块: from gunicorn import config [as 别名]
# 或者: from gunicorn.config import make_settings [as 别名]
def make_options():
opts = [
make_option('--adminmedia', dest='admin_media_path', default='',
help='Specifies the directory from which to serve admin media.')
]
g_settings = make_settings(ignore=("version"))
keys = g_settings.keys()
for k in keys:
if k in ('pythonpath', 'django_settings',):
continue
setting = g_settings[k]
if not setting.cli:
continue
args = tuple(setting.cli)
kwargs = {
"dest": setting.name,
"metavar": setting.meta or None,
"action": setting.action or "store",
"type": setting.type or "string",
"default": None,
"help": "%s [%s]" % (setting.short, setting.default)
}
if kwargs["action"] != "store":
kwargs.pop("type")
opts.append(make_option(*args, **kwargs))
return tuple(opts)