How to compile Django messages after app is deployed?

I am deploying a Django application inside a DigitalOcean App, everything is working fine except Django translations.

I check my ~/locale/en/LC_MESSAGES$ and see only my django.po file. I need to generate the .mo file. But how can I run the command django-admin compilemessages from the console? I need the virtual environment, right?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
April 19, 2023


App Platform checks your code to determine what language or framework it uses. If it supports the language or framework, it chooses an appropriate resource type and uses the proper buildpack to build the app and deploy a container.

heroku-buildpack-python is utilized as the buildpack for detecting and building your Python applications.

What you can do is, open your requirements.txt file. If you don’t have one, create it. Add the following line:


This will add the gettext package to the list of requirements that DigitalOcean App will install when deploying your application.

During the deployment process, DigitalOcean App will automatically download and install the gettext package, which includes the msgfmt command required to compile the translation files.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel