Search code examples
pythondjangotranslation

Git command when translating files in Django


I have an existing application in Django. I want to add a translation on the page. On page I have:

{% trans 'Projects'%}

In .po file I added:

#: templates/staff/site.html: 200
msgid "Projects"
msgid "Projekty"

Then executes the command:

django-admin.py compilemessages -l pl

After this command, I get an error:

CommandError: This Should Be Run script from the Django Git checkout or your project or app tree, or with the settings Specified module.

Solution

  • The error holds the answer, you could be running the script from anywhere so it cannot know which files to compile. Run the command from the project directory or specify the settings and you should be fine.