简体   繁体   中英

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

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?

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

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM