My translations are working locally, but in production at Heroku, my site remains in its default language (English) after changing the language.
These are in my settings.py
file:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
USE_I18N = True
USE_L10N = True
LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
This is my structure:
myproject
├── Procfile
├── locale
│ └── fr
│ └── LC_MESSAGES
│ ├── django.mo
│ └── django.po
├── myproject
│ ├── __init__.py
│ └── settings.py
I thought it was a path issue so I SSH'd into my Heroku app and printed LOCALE_PATHS
:
>>> from myproject.settings import LOCALE_PATHS
>>> print(LOCALE_PATHS)
['/app/locale']
And pwd
in locale/
returns pwd
/app/locale
.
What did I do wrong?
I found the issue:
my django.mo
file was ignored by .gitignore
as I use the default GitHub Python gitignore file.