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


Python BaseCommand.add_arguments方法代码示例

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


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

示例1: add_arguments

# 需要导入模块: from django.core.management.base import BaseCommand [as 别名]
# 或者: from django.core.management.base.BaseCommand import add_arguments [as 别名]
    def add_arguments(self, parser):
        BaseCommand.add_arguments(self, parser)

        parser.add_argument('addrport', nargs='?',
            help='Optional port number, or ipaddr:port')

        # The below flags are for legacy compat.
        # 2017-06-08 added addrport positional argument,
        # because:
        # - more consistent with runserver.
        # - don't have to remember the name of the flags (is it --bind or --addr etc)
        # - quicker to type
        # - we don't need positional args for anything else

        parser.add_argument(
            '--addr', action='store', type=str, dest='addr', default=None,
            help='The host/address to bind to (default: {})'.format(DEFAULT_ADDR))

        ahelp = (
            'Port number to listen on. Defaults to the environment variable '
            '$PORT (if defined), or {}.'.format(DEFAULT_PORT)
        )
        parser.add_argument(
            '--port', action='store', type=int, dest='port', default=None,
            help=ahelp)
        ahelp = (
            'Run an SSL server directly in Daphne with a self-signed cert/key'
        )
        parser.add_argument(
            '--dev-https', action='store_true', dest='dev_https', default=False,
            help=ahelp)
开发者ID:oTree-org,项目名称:otree-core,代码行数:33,代码来源:webandworkers.py

示例2: add_arguments

# 需要导入模块: from django.core.management.base import BaseCommand [as 别名]
# 或者: from django.core.management.base.BaseCommand import add_arguments [as 别名]
    def add_arguments(self, parser):
        BaseCommand.add_arguments(self, parser)

        ahelp = ('TODO')
        parser.add_argument(
            '--reload', action='store_true', dest='use_reloader',
            default=False, help=ahelp)

        ahelp = (
            'The port that the http server should run on. It defaults to '
            '5000. This value can be set by the environment variable $PORT.')
        parser.add_argument(
            '--port', action='store', type=int, dest='port', default=None,
            help=ahelp)
        parser.add_argument(
            '--addr', action='store', type=str, dest='addr', default='0.0.0.0',
            help=ahelp)
开发者ID:BertrandBordage,项目名称:otree-core,代码行数:19,代码来源:webandworkers.py

示例3: add_arguments

# 需要导入模块: from django.core.management.base import BaseCommand [as 别名]
# 或者: from django.core.management.base.BaseCommand import add_arguments [as 别名]
    def add_arguments(self, parser):
        BaseCommand.add_arguments(self, parser)

        ahelp = ('TODO')
        parser.add_argument(
            '--reload', action='store_true', dest='use_reloader',
            default=False, help=ahelp)
        ahelp = (
            'Port number to listen on. Defaults to the environment variable '
            '$PORT (if defined), or 8000.'
        )
        parser.add_argument(
            '--port', action='store', type=int, dest='port', default=None,
            help=ahelp)
        parser.add_argument(
            '--addr', action='store', type=str, dest='addr', default='0.0.0.0',
            help='The host/address to bind to (default: 0.0.0.0)')
        parser.add_argument(
            '--botworker', action='store_true',
            dest='botworker', default=False,
            help='Run botworker (for browser bots)')
开发者ID:ross2604,项目名称:otree-core,代码行数:23,代码来源:webandworkers.py

示例4: add_arguments

# 需要导入模块: from django.core.management.base import BaseCommand [as 别名]
# 或者: from django.core.management.base.BaseCommand import add_arguments [as 别名]
 def add_arguments(self, parser):
     BaseCommand.add_arguments(self, parser)
开发者ID:mattboehm,项目名称:otree-core,代码行数:4,代码来源:timeoutworker.py


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