Could not import 'oauth2_provider.ext.rest_framework.OAuth2Authentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'

后端 未结 2 2082
夕颜
夕颜 2021-02-12 18:43

It\'s the first time I work with django rest and Django Oauth toolkit I\'m following this tutorial oauth2-with-django-rest-framework But when I run python manage.py migrate I g

2条回答
  •  天涯浪人
    2021-02-12 19:06

    It looks like oath2_provider.ext has been moved to oauth_provider.contrib. You could try installing an older version of django-oauth-toolkit, or try changing the value in DEFAULT_AUTHENTICATION_CLASSES from:

    'oauth2_provider.ext.rest_framework.OAuth2Authentication',
    

    to:

    'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
    

    Note that the tutorial is a couple of years old, you might find other problems like this.

提交回复
热议问题