Is there any way to check if command exists?
I know that I can write:
try:
call_command('some')
except:
开发者_如何学JAVA print "Command does not exists"
but maybe django allow to check if command is available?
See get_commands
:
from django.core.management import get_commands, call_command
if 'some_command' in get_commands():
call_command('some_command')
精彩评论