Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot generate django.po files from docker-compose

I'm using Django 3.0.5 inside of a docker-container, linked to an Postgres-container.

I would like to generate django.po files but when I'm trying to use this command:

docker-compose run web python3 manage.py makemessages -l en

I got this error:

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

Meanwhile, when I directly access to my container, it works: (Here, ad2b13f2fe87 is the ID of my django-container)

docker exec -it ad2b13f2fe87 bash

root@ad2b13f2fe87:/code# gettext --version
gettext (GNU gettext-runtime) 0.19.8.1
...

root@ad2b13f2fe87:/src# python3 manage.py makemessages -l en
processing locale en

Can someone explain me what the issue is? Thank you.

like image 321
Bravo2bad Avatar asked Oct 14 '25 15:10

Bravo2bad


1 Answers

Nevermind, I found the issue.

By default, the Python image I use as Django is not updated.

In my Python (Django) Dockerfile, I just added:

RUN apt update
RUN apt install gettext -y

And in my requirements.txt, I also added this:

# i18n
python-gettext==4.0 

Now, the command docker-compose run <python-django-service> python3 manage.py makemessages -l en works and my django.po files are correctly generated.

like image 139
Bravo2bad Avatar answered Oct 17 '25 06:10

Bravo2bad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!