python execute_command err_Python management.execute_from_command_line方法代碼示例

本文汇总了Python中django.core.management.execute_from_command_line方法的多种使用示例,适用于需要了解或使用该方法的开发者。从不同项目中提取的代码片段展示了如何在不同场景下调用和配置execute_from_command_line。
摘要由CSDN通过智能技术生成

本文整理匯總了Python中django.core.management.execute_from_command_line方法的典型用法代碼示例。如果您正苦於以下問題:Python management.execute_from_command_line方法的具體用法?Python management.execute_from_command_line怎麽用?Python management.execute_from_command_line使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊django.core.management的用法示例。

在下文中一共展示了management.execute_from_command_line方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。

示例1: runtests

​點讚 6

# 需要導入模塊: from django.core import management [as 別名]

# 或者: from django.core.management import execute_from_command_line [as 別名]

def runtests():

parsed_args, unparsed_args = parse_args()

only_wagtailmenus = r'^wagtailmenus(\.|$)'

if parsed_args.deprecation == 'all':

# Show all deprecation warnings from all packages

warnings.simplefilter('default', category=DeprecationWarning)

warnings.simplefilter('default', category=PendingDeprecationWarning)

elif parsed_args.deprecation == 'pending':

# Show all deprecation warnings

warnings.filterwarnings('default', category=DeprecationWarning, module=only_wagtailmenus)

warnings.filterwarnings('default', category=PendingDeprecationWarning, module=only_wagtailmenus)

elif parsed_args.deprecation == 'imminent':

# Show only imminent deprecation warnings

warnings.filterwarnings('default', category=DeprecationWarning, module=only_wagtailmenus)

elif parsed_args.deprecation == 'none':

# Deprecation warnings are ignored

pass

argv = [sys.argv[0], 'test'] + unparsed_args

return execute_from_command_line(argv)

開發者ID:rkhleics,項目名稱:wagtailmenus,代碼行數:23,

示例2: execute_from_command_line

​點讚 6

# 需要導入模塊: from django.core import management [as 別名]

# 或者: from django.core.management import execute_from_command_line [as 別名]

def execute_from_command_line():

# Limit concurrency in all thread-pools to ONE.

from maasserver.utils import threads

threads.install_default_pool(maxthreads=1)

threads.install_database_unpool(maxthreads=1)

# Disable all database connections in the reactor.

from maasserver.utils import orm

from twisted.internet import reactor

assert not reactor.running, "The reactor has been started too early."

reactor.callFromThread(orm.disable_all_database_connections)

# Configure logging; Django is no longer responsible for this. Behave as

# if we're always at an interactive terminal (i.e. do not wrap stdout or

# stderr with log machinery).

from provisioningserver import logger

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值