Django locale not working on production
Hi, I deployed a django app and I use locale settings for 2 languages: english and greek. Although locally works fine, after deployment the greek language urls don't work. Any idea why?
in settings.py i have this config:
LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
EXTRA_LANG_INFO = {
'gr': {
'bidi': False,
'code': 'gr',
'name': 'greek',
'name_local': 'Ελληνικά',
},
'en': {
'bidi': False,
'code': 'en',
'name': 'English',
'name_local': 'English',
},
}
LANG_INFO = dict(EXTRA_LANG_INFO.items())
django.conf.locale.LANG_INFO = LANGINFO
LANGUAGES = (
('en', ('English')),
('gr', _('Greek')),
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale/'),
)
Project id: afb57b50-917e-49d3-a975-e7f460f74eb6
8 Replies
Project ID:
afb57b50-917e-49d3-a975-e7f460f74eb6
do you have the tzdata package in your requirements.txt?
Yes, tzdata==2023.3
Solution
is gr even the correct language code for greek?
looks like iso 639-1 is used, and that means the language code is
el
Ok, I thought it was gr because it worked locally. I'll change it to el. Thanks for suggestion, I didn't notice it
Yes, that worked! Thank you for your help
no problem! guess your local computer's locale database has gr for greek too