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


Python ManagementUtility.prog_name方法代码示例

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


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

示例1: manage

# 需要导入模块: from django.core.management import ManagementUtility [as 别名]
# 或者: from django.core.management.ManagementUtility import prog_name [as 别名]
def manage(command, args=[], in_background=False):
    """
    Run a django command on the kalite project

    :param command: The django command string identifier, e.g. 'runserver'
    :param args: List of options to parse to the django management command
    :param in_background: Creates a sub-process for the command
    """
    # Ensure that django.core.management's global _command variable is set
    # before call commands, especially the once that run in the background
    get_commands()
    # Import here so other commands can run faster
    if not in_background:
        utility = ManagementUtility([os.path.basename(sys.argv[0]), command] + args)
        # This ensures that 'kalite' is printed in help menus instead of
        # 'kalitectl.py' (a part from the top most text in `kalite manage help`
        utility.prog_name = 'kalite manage'
        utility.execute()
    else:
        if os.name != "nt":
            thread = ManageThread(command, args=args, name=" ".join([command]+args))
            thread.start()
        else:
            # TODO (aron): for versions > 0.13, see if we can just have everyone spawn another process (Popen vs. ManageThread)
            Popen([sys.executable, os.path.abspath(sys.argv[0]), "manage", command] + args, creationflags=CREATE_NEW_PROCESS_GROUP)
开发者ID:JGOODYEARUCSD,项目名称:ka-lite,代码行数:27,代码来源:kalitectl.py

示例2: manage

# 需要导入模块: from django.core.management import ManagementUtility [as 别名]
# 或者: from django.core.management.ManagementUtility import prog_name [as 别名]
def manage(command, args=None, as_thread=False):
    """
    Run a django command on the kalite project

    :param command: The django command string identifier, e.g. 'runserver'
    :param args: List of options to parse to the django management command
    :param as_thread: Runs command in thread and returns immediately
    """

    if not args:
        args = []

    args = update_default_args(["--traceback"], args)

    if not as_thread:
        utility = ManagementUtility([os.path.basename(sys.argv[0]), command] + args)
        # This ensures that 'kalite' is printed in help menus instead of
        # 'kalite' or 'kalite.__main__' (a part from the top most text in `kalite manage help`
        utility.prog_name = 'kalite manage'
        utility.execute()
    else:
        get_commands()  # Needed to populate the available commands before issuing one in a thread
        thread = ManageThread(command, args=args, name=" ".join([command] + args))
        thread.start()
        return thread
开发者ID:ruimalheiro,项目名称:ka-lite,代码行数:27,代码来源:cli.py

示例3: manage

# 需要导入模块: from django.core.management import ManagementUtility [as 别名]
# 或者: from django.core.management.ManagementUtility import prog_name [as 别名]
def manage(command, args=[], as_thread=False):
    """
    Run a django command on the kalite project

    :param command: The django command string identifier, e.g. 'runserver'
    :param args: List of options to parse to the django management command
    :param as_daemon: Creates a new process for the command
    :param as_thread: Runs command in thread and returns immediately
    """
    
    if not as_thread:
        if PROFILE:
            profile_memory()

        utility = ManagementUtility([os.path.basename(sys.argv[0]), command] + args)
        # This ensures that 'kalite' is printed in help menus instead of
        # 'kalitectl.py' (a part from the top most text in `kalite manage help`
        utility.prog_name = 'kalite manage'
        utility.execute()
    else:
        get_commands()  # Needed to populate the available commands before issuing one in a thread
        thread = ManageThread(command, args=args, name=" ".join([command] + args))
        thread.start()
开发者ID:SG345,项目名称:ka-lite,代码行数:25,代码来源:kalitectl.py

示例4: run

# 需要导入模块: from django.core.management import ManagementUtility [as 别名]
# 或者: from django.core.management.ManagementUtility import prog_name [as 别名]
 def run(self):
     utility = ManagementUtility([os.path.basename(sys.argv[0]), self.command] + self.args)
     # This ensures that 'kalite' is printed in help menus instead of
     # 'kalitectl.py' (a part from the top most text in `kalite manage help`
     utility.prog_name = 'kalite manage'
     utility.execute()
开发者ID:JGOODYEARUCSD,项目名称:ka-lite,代码行数:8,代码来源:kalitectl.py


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