Search code examples
djangodeploymentgettextpomo

How to have django compile .mo files at startup?


What I am trying to achieve is when a django projects starts, have it run compilemessages automatically in a cross-platform way. That way the mo files don't need to be checked into source control, and when translations are added in branches and then merged back conflicts don't occur.

I'm having trouble with this because from what I gather, compilemessages depends on settings.py, so if you try to run it from settings.py it detects the circular reference and then doesn't run.


Solution

  • As mentionned in this other question Subversion update hooks depend on the client, so i'd just suggest a shell script that does :

    svn update
    python manage.py compilemessages 
    

    And you run this script when you want to deploy.