Django -Gunicorn not serving internationalized app -throwing 'Internal Server Error: /ja/ ' and "KeyError: 'translate' "

My Django app uses internationalization to support English and Japanese languages with Japanese being the default language. The language codes are appended to the app's URLs so all of my URLs either look like this

or like this

If you navigate to , my config automatically appends '/ja/' to the the URL and redirects to which I suspect may be a problem but I am not sure.

I also have {% translate ' ' %} tags all over the place in my templates for internationalization.

Everything works perfectly while running Django's built in server. When I execute this command in the terminal:

'gunicorn Main_Project.wsgi'

it seems to run and successfully listen to which is the same ip address that django's runserver command listens to.

But when I navigate to, in the terminal where Gunicorn is running I am getting an "Internal Server Error: /ja/" and a 'KeyError: 'translate''

This is the line in the code that Gunicorn is complaining about:

<a href="/{{LANGUAGE_CODE}}/account/myaccount/" title="My Account">{% translate "アカウント" %}</a>

But this line works perfectly when running python runserver, so I am 100% sure there are no syntax errors. So the only thing I can think of is that I am doing something ignorantly with Gunicorn's configuration and so I come to you to help diagnose the problem. Any tips or advice will be greatly appreciated.

Thank you!

Back to Top