本文整理匯總了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
<