0
有沒有什麼辦法檢查命令是否存在?檢查命令是否存在
我知道我可以寫:
try:
call_command('some')
except:
print "Command does not exists"
但也許Django的允許檢查命令可用?
有沒有什麼辦法檢查命令是否存在?檢查命令是否存在
我知道我可以寫:
try:
call_command('some')
except:
print "Command does not exists"
但也許Django的允許檢查命令可用?
from django.core.management import get_commands, call_command
if 'some_command' in get_commands():
call_command('some_command')