I am trying to figure out how to port our django t...
# general
l
I am trying to figure out how to port our django translations generation code to a pants-based build system. I assume the way I would need to do this is a codegen plugin? Is there a more straightforward way?
h
cc @clean-city-64472 who probably has thoughts/ideas here
How does it work now? Does it run
manage.py
?
l
yeah manage.py
c
I think we run compilemessages on the server during deploy. Makemessages is like migrations. Haven't looked at it in a long time so not super helpful here and I don't think our solution was very elegant in the end.
l
yeah my challenge right now is that I need makemessages to run before tests run
(I think)
c
I think we might have a pytest fixture that runs it
👍 1
Will check when I'm on my laptop
l
ah interesting
h
The issue with makemigrations is that it writes the migration files relative to the models source files, which means if you run
./pants run path/to/manage.py makemigrations
it writes them in the sandbox, and not the source tree. I imagine something similar might happen for makemessages.
So it might be time for a django-aware plugin that can handle this
2
c
Copy code
import pytest

from django.core.management import call_command


@pytest.fixture(scope="session")
def translations():
    call_command("makemessages", "--all")
    call_command("compilemessages")
@loud-laptop-17949
👍 1
🎉 1