Django: call standard command from a custom command

45 Views Asked by At

In my app, i am using a custom system for managing localization strings. In that connection, I have written a custom command that generates *.po files. However, after running that command, I have to manually call the compilemessages command. What I would like to do is to call the compilemessages command from my custom one. Is there a way to do that?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use call_command():

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