Search code examples
divio

Divio Cloud (formerly "Aldryn"): manage.py makemessages: Can't find xgettext


If I execute the following in a Divio Cloud (formerly known as "Aldryn") project:

docker-compose run --rm web python manage.py makemessages

I get:

CommandError: Can't find xgettext. Make sure you have GNU gettext tools 0.15 or newer installed.

  • Is running `manage.py makemessages the right way to create / update message files on Divio Cloud?

As a workaround I have added this to the Dockerfile:

# add gettext for manage.py makemessages RUN apt-get update && apt-get install -y gettext

and then

docker-compose build web

  • Also, will the .mo files be compiled on Divio Cloud deployment or does one have to precompile them?

Solution

  • Currently Aldryn does not support generating the .mo files for you. While waiting for Aldryn itself to provide support for this out of the box, you can work around the issue by editing the Dockerfile, as you already did:

    1) Towards the top, just before the # <DOCKER_BUILD>, add the following command (as you already pointed out):

    # add gettext for manage.py makemessages 
    RUN apt-get update && apt-get install -y gettext && apt-get clean && rm -rf /var/lib/apt/lists/*
    

    2) At the bottom, just after the # </DOCKER_BUILD>, add the following command:

    # compile the messages
    RUN DJANGO_MODE=build python manage.py compilemessages
    

    Edit: If you're using baseproject>=3.13.1, step 1) is not needed anymore.