Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django:从自定义命令调用标准命令_Django_Django Management Command - Fatal编程技术网

Django:从自定义命令调用标准命令

Django:从自定义命令调用标准命令,django,django-management-command,Django,Django Management Command,在我的应用程序中,我使用自定义系统来管理本地化字符串。在这方面,我编写了一个自定义命令,生成*.po文件。但是,在运行该命令之后,我必须手动调用compilemessages命令。我想做的是从我的自定义命令调用compilemessages命令。有办法吗?您可以使用: from django.core.management import call_command # generate your *.po files, then call_command('compilemessages')

在我的应用程序中,我使用自定义系统来管理本地化字符串。在这方面,我编写了一个自定义命令,生成
*.po
文件。但是,在运行该命令之后,我必须手动调用
compilemessages
命令。我想做的是从我的自定义命令调用
compilemessages
命令。有办法吗?

您可以使用:

from django.core.management import call_command
# generate your *.po files, then
call_command('compilemessages')