2017-07-21 76 views
0

当我尝试使用命令python manage.py create superuser时,它显示我错误。任何帮助深表感谢。python manage.py createsuperuser错误导入

ImportError: Could not import 'oauth2_provider.ext.rest_framework.OAuth2Authentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ImportError: No module named ext.rest_framework. 

Ubuntu的16

+0

我们怎么能帮助你没有源代码? – Arount

+0

请参阅https://stackoverflow.com/questions/45029183/could-not-import-oauth2-provider-ext-rest-framework-oauth2authentication-for-a –

+0

尝试使用python manage.py createsuperuser –

回答

0

你需要使用PIP 3安装Django的REST框架(PIP为Python 3):如何安装PIP 3

pip3 install djangorestframework 

说明可以发现here

您可以尝试安装旧版本的django-oauth-toolkit,或者通过更改DEFAULT_AUTHENTICATION_CLASSES中的值来尝试:

'oauth2_provider.ext.rest_framework.OAuth2Authentication',

到:

'oauth2_provider.contrib.rest_framework.OAuth2Authentication',

+0

DEFAULT_AUTHENTICATION_CLASSES - 我可以找到它?它在哪里? –

+0

或者我可以如何安装旧版本? –

+0

你可以用这个命令安装:pip install django-oauth-toolkit –