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


Python base.BaseCommand类代码示例

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


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

示例1: __init__

 def __init__(self, *args, **kwargs):
     """
         Creation of the ejabberd atuh bridge service.
         :Parameters:
             - `args`: all non-keyword arguments
             - `kwargs`: all keyword arguments
     """
     BaseCommand.__init__(self, *args, **kwargs)
     try:
         log_level = int(logging.DEBUG)
     except:
         log_level = logging.INFO
     if os.access("/var/log/ejabberd/kauth.log", os.W_OK):
         logging.basicConfig(
                             level=log_level,
                             format='%(asctime)s %(levelname)s %(message)s',
                             filename="/var/log/ejabberd/kauth.log",
                             filemode='a')
     else:
         logging.basicConfig(
                             level=log_level,
                             format='%(asctime)s %(levelname)s %(message)s',
                             stream=sys.stderr)
         logging.warn(('Could not write to ' +
                       '/var/log/ejabberd/kauth.log' +
                       '. Falling back to stderr ...'))
     logging.info(('ejabberd kauth process started' +' (more than one is common)'))
开发者ID:ashish-arora,项目名称:school,代码行数:27,代码来源:kauth.py

示例2: __init__

    def __init__(self, *args, **kwargs):

        self.verbosity = 0
        self.stats = {}
        self._ignore = []

        BaseCommand.__init__(self, *args, **kwargs)
开发者ID:waynew,项目名称:paperless,代码行数:7,代码来源:document_consumer.py

示例3: __init__

    def __init__(self):
        BaseCommand.__init__(self)

        self.option_list += (
            make_option("--queues", "-q", help="Queues to include (default: all). Use queue slugs"),
            make_option("--verbose", "-v", action="store_true", default=False, help="Display a list of dates excluded"),
        )
开发者ID:erikriver,项目名称:django-helpdesk,代码行数:7,代码来源:escalate_tickets.py

示例4: add_arguments

    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,代码行数:31,代码来源:webandworkers.py

示例5: __init__

    def __init__(self, *args, **kwargs):
        """
        Creation of the ejabberd atuh bridge service.

        :Parameters:
           - `args`: all non-keyword arguments
           - `kwargs`: all keyword arguments
        """
        BaseCommand.__init__(self, *args, **kwargs)
        try:
            log_level = int(settings.TUNNEL_EJABBERD_AUTH_GATEWAY_LOG_LEVEL)
        except:
            log_level = logging.INFO
        # If we can write to the log do so, else fail back to the console
        if os.access(settings.TUNNEL_EJABBERD_AUTH_GATEWAY_LOG, os.W_OK):
            logging.basicConfig(
                level=log_level,
                format='%(asctime)s %(levelname)s %(message)s',
                filename=settings.TUNNEL_EJABBERD_AUTH_GATEWAY_LOG,
                filemode='a')
        else:
            logging.basicConfig(
                level=log_level,
                format='%(asctime)s %(levelname)s %(message)s',
                stream=sys.stderr)
            logging.warn(('Could not write to ' +
                settings.TUNNEL_EJABBERD_AUTH_GATEWAY_LOG +
                '. Falling back to stderr ...'))
        logging.info(('ejabberd_auth_bridge process started' +
            ' (more than one is common)'))
开发者ID:talkinlocal,项目名称:django-eveauth,代码行数:30,代码来源:jabber_bridge.py

示例6: __init__

 def __init__(self):
     BaseCommand.__init__(self)
     self.style = no_style()
     # Keep a count of the installed objects and ontologies
     self.count = [0, 0]
     self.models = set()
     self.verbosity, self.show_traceback, self.fail_gracefully = 1, False, False
开发者ID:pombredanne,项目名称:django-rdf,代码行数:7,代码来源:syncvb.py

示例7: __init__

    def __init__(self, *args, **kwargs):
        class NiceContext(Context):
            """
            Same as the real context class, but override some methods in order to gain
            nice colored output.
            """
            def __init__(s, *args, **kwargs):
                kwargs['insert_debug_symbols'] = self.insert_debug_symbols
                Context.__init__(s, *args, **kwargs)

            def compile_media_callback(s, compress_tag, media_files):
                """
                When the compiler notifies us that compiling of this file begins.
                """
                if compress_tag:
                    print self.colored('Compiling media files from', 'yellow'),
                    print self.colored(' "%s" ' % compress_tag.path, 'green'),
                    print self.colored(' (line %s, column %s)" ' % (compress_tag.line, compress_tag.column), 'yellow')
                else:
                    print self.colored('Compiling media files', 'yellow')

                for m in media_files:
                    print self.colored('   * %s' % m, 'green')

            def compile_media_progress_callback(s, compress_tag, media_file, current, total, file_size):
                """
                Print progress of compiling media files.
                """
                print self.colored('       (%s / %s):' % (current, total), 'yellow'),
                print self.colored(' %s (%s bytes)' % (media_file, file_size), 'green')
        self.NiceContext = NiceContext

        BaseCommand.__init__(self, *args, **kwargs)
开发者ID:twidi,项目名称:django-template-preprocessor,代码行数:33,代码来源:compile_templates.py

示例8: __init__

 def __init__(self):
     BaseCommand.__init__(self)
     self.found = 0
     self.no_match = 0
     from_coord = SpatialReference(900913)
     to_coord = SpatialReference(4326)
     self.trans = CoordTransform(from_coord, to_coord)
     self.rtrans = CoordTransform(to_coord, from_coord)
开发者ID:atiberghien,项目名称:django-epci,代码行数:8,代码来源:import_delim.py

示例9: __init__

    def __init__(self):
        BaseCommand.__init__(self)

        self.option_list += (
            make_option(
                '--queues', '-q',
                help='Queues to include (default: all). Use queue slugs'),
            )
开发者ID:ASDAFF,项目名称:django-helpdesk,代码行数:8,代码来源:create_queue_permissions.py

示例10: __init__

    def __init__(self, *args, **kwargs):

        self.verbosity = 0

        self.file_consumer = None
        self.mail_fetcher = None

        BaseCommand.__init__(self, *args, **kwargs)
开发者ID:CryptoGir,项目名称:paperless,代码行数:8,代码来源:document_consumer.py

示例11: __init__

    def __init__(self, *args, **kwargs):

        self.logger = logging.getLogger(__name__)

        BaseCommand.__init__(self, *args, **kwargs)

        self.username = settings.MAIL_POLLING["username"]
        self.password = settings.MAIL_POLLING["password"]
        self.host = settings.MAIL_POLLING["host"]
开发者ID:UKTradeInvestment,项目名称:barbara,代码行数:9,代码来源:monitor.py

示例12: __init__

 def __init__(self):
     BaseCommand.__init__(self)
     self.option_list += (
         make_option(
             '--quiet', '-q',
             default=False,
             action='store_true',
             help='Hide all command output'),
         )
开发者ID:acrooo,项目名称:Adlibre-DMS,代码行数:9,代码来源:import_mdt.py

示例13: __init__

 def __init__(self, *largs, **kwargs):
     BaseCommand.__init__(self, *largs, **kwargs)
     from django.conf import settings
     self.cascade = False
     if settings.DATABASE_ENGINE:
         self.cascade = settings.DATABASE_ENGINE.find('postgresql') >= 0
     elif settings.DATABASES:
         db_settings = settings.DATABASES.get('default')
         self.cascade = db_settings.get('ENGINE').find('postgresql') >= 0
开发者ID:D3f0,项目名称:django-admin-extras,代码行数:9,代码来源:tabledrop.py

示例14: __init__

 def __init__(self, *args, **kwargs):
     BaseCommand.__init__(self, *args, **kwargs)
     self.local_enabled = False
     # Change this to True to log requests for debug *logs may include passwords*
     self.LOGGING_ENABLED = False
     if get_config("JABBER_LOCAL_ENABLED",None).value == "1":
         self.local_enabled = True
         self.local_user = get_config("JABBER_FROM_JID", False).value.split('@')[0]
         self.local_pass = get_config("JABBER_FROM_PASSWORD", False).value
         self.space_char = get_config("JABBER_LOCAL_SPACE_CHAR", False).value
开发者ID:EasyCompany2020,项目名称:eve-wspace,代码行数:10,代码来源:ejabberd_auth_bridge.py

示例15: __init__

    def __init__(self):
        BaseCommand.__init__(self)

        self.option_list += (
            make_option(
                '--quiet', '-q',
                default=False,
                action='store_true',
                help='Hide details about each queue/message as they are processed'),
            )
开发者ID:tdruiva,项目名称:django-helpdesk,代码行数:10,代码来源:get_email.py


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