簡體   English   中英

在 Django4.0 中不能使用 Django-rest-auth; ImportError:無法從“django.utils.translation”導入名稱“ugettext_lazy”

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

現在我正在 Django4.0 和 Django-rest-auth 中構建 Django Rest 框架。 我知道 django4.0 不支持 ugettext_lazy。 它支持 gettext_lazy 而不是。 我在我的應用程序中安裝了 django-rest-auth==0.9.5。 然后它提出了這個問題。

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

這是我的設置:

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

在 Django4.0 中,我不能使用 django-rest-auth 嗎?

您可以嘗試使用dj-rest-auth而不是django-rest-authdj-rest-authdjango-rest-auth的較新分支

所以使用allauth進行設置、配置和遷移都是一樣的

不要擔心dj-rest-auth使用gettext_lazy

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM