本文整理汇总了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)
示例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)
示例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)')
示例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)