2👍
✅
You can use call_command():
from django.core.management import call_command
# generate your *.po files, then
call_command('compilemessages')
Source:stackexchange.com