Can not use Django-rest-auth in Django4.0 ; ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation'

Question:

For now I am building the Django Rest Framework in Django4.0 and Django-rest-auth.
I knew the django4.0 does not support the ugettext_lazy. it support the gettext_lazy instead of.
I installed the django-rest-auth==0.9.5 in my app. and then it raised the issue.

ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation'

Here is my settings:

THIRD_PARTY_APPS = [        
    'escapejson',
    'corsheaders',
    'rest_framework_swagger',
    'rest_framework',    
    'rest_auth',    
    'drf_yasg',
    'django_jsonfield_backport',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
]
INSTALLED_APPS = LOCAL_APPS + DJANGO_APPS + THIRD_PARTY_APPS

In Django4.0, Can not I use the django-rest-auth?

Asked By: MaSao93

||

Answers:

You can try using dj-rest-auth instead of django-rest-auth, dj-rest-auth is a newer fork of django-rest-auth.

so there setup and configuration and migration with allauth are all the same.

and worry not dj-rest-auth uses gettext_lazy.

Answered By: Ahmad Othman