3
我想爲我的Django REST API(使用DjangoRestFramework和Django-Oauth-Toolkit)設置OAuth2身份驗證系統。 我根據官方文檔寫的一切,但系統給出的錯誤「無法導入ext.rest_framework」Django OAuth工具包:無法導入ext.rest_framework
這裏是我的setting.py文件:
OAUTH2_PROVIDER = {
# this is the list of available scopes
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
}
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
],
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',),
'PAGE_SIZE': 10
}
謝謝!