user1261774 user1261774 - 6 months ago 50
Python Question

django makemessages issue

I am running python 2.7 and django 1.8.11 on Windows 7.

After adding in the necessary translation string literals, I am trying to translate my site. I have followed the instructions as per the docs. This includes installing the GNU gettext utilities for windows 7 and the necessary locale folders/directories in the correct language code.

In the virtual environment & at the command prompt of the root directory of my project, I run:

django-admin makemessages -l de


I get the following error at the command prompt:

CommandError: Unable to find a locale path to store translations for file fabfile.py


In the root directory of my project, I have the following files, which is where the
fabfile.py
is located:

enter image description here

I have tried (temporarily) removing the
fabfile.py
from the directory. When I tried this, the error message I received when running
django-admin makemessages -l de
is:

CommandError: Unable to find a locale path to store translations for file manage.py


It appears that the
makemessages
command is including all the
.py
and
.txt
files in the root directory. I am not sure if this is the correct procedure or not.

How do I not include the .py & .txt files in the root directory of my project when I run the
makemessages
command?

Answer

I am not sure how or why, but when I tried this yesterday, it did not work, but now does work. Very frustrating.

I had to run the makemessages command one extra directory inside my project root directory.

I hope this helps someone out there.