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
}
谢谢!