I am following Django Doc, but I get the following error message when I do as it says.
"The translation infrastructure cannot be initialized before the "
django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.
Settings.py
LANGUAGE_CODE = 'en'
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale/'),
)
USE_I18N = True
USE_L10N = True
USE_TZ = True
TIME_ZONE = 'Europe/Copenhagen'
from django.utils.translation import ugettext as _
LANGUAGES = [
('da', _('Danish')),
('en', _('English')),
]
I understand this is because translation is being called before the necessary lib is loaded, but how can I change it if the documentation says this way?
WSGI.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_app.settings")
application = get_wsgi_application()