Ibolit
Ibolit

Reputation: 9730

Django: call standard command from a custom command

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?

Upvotes: 1

Views: 36

Answers (1)

rafalmp
rafalmp

Reputation: 4068

You can use call_command():

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

Upvotes: 2

Related Questions