Make sure that you have the request and i18n context processors included in the TEMPLATES['OPTIONS']['context_processors'] setting, as follows:
# settings.py or config/base.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# ...
'OPTIONS': {
'context_processors': [
# ...
'django.template.context_processors.request',
'django.template.context_processors.i18n',
],
},
},
]
Also, create the utils app, if you haven't done so already, and place it under INSTALLED_APPS in the settings:
# settings.py or config/base.py INSTALLED_APPS = [
# ...
'utils', )