i18n doesn't work at production environment on heroku

前端 未结 7 1470
陌清茗
陌清茗 2021-01-05 02:30

I have seen more than one hundred posts about i18n issues and no solution seems to solve my problem.

I have an app running with Django 1.3.1 and it works Fine at my

7条回答
  •  -上瘾入骨i
    2021-01-05 03:02

    First of all, your language settings are wrong.

    It should be like:

    LANGUAGES = (
        ('zh', 'China'),
        ('en', 'English'),
        ('ja', 'Japanese'),
    )
    

    Next, check if the domain in your cookie settings are correct.

    I had the same problem and thought Heroku's virtual environment would never support i18n, but finally found out that my 'django-language' value in the session cookie belongs to my local testing server '0.0.0.0:5000'.

    After changing the settings, my translations done on the local server worked out of the box.

提交回复
热议问题