我正在尝试使用call_command
从 URL 下载数据,并且想知道如何从代码中调用它。
我在我的代码中声明了如下选项列表:
option_list = BaseCommand.option_list + (
make_option('--url', default=None, dest='url', help=_(u'Specifies the full url of the json data to download.')),
make_option('--username', default=None, dest='username', help=_(u'Login of the person doing the download.')),
make_option('--password', default=None, dest='password', help=_(u'Password of the person doing the download.')),
make_option('--file', default=None, dest='file', help=_(u'File name of the json data to download in gzip-compressed-data format')),
)
我从命令行按如下方式使用它:
./manage.py download --url=http://some-link.com/download/ --username=admin --password=admin
到目前为止,我有以下内容:
call_command('download')
如何传递其余的参数/参数?