我正在使用Python 3.6,Django 2.0.7和以下人员进行项目:
certifi==2018.4.16
chardet==3.0.4
defusedxml==0.5.0
dj-database-url==0.4.1
Django==2.0.7
django-bootstrap3==7.0.1
django-braces==1.13.0
django-oauth-toolkit==1.2.0
django-rest-framework-social-oauth2==1.0.4
djangorestframework==3.8.2
gunicorn==19.6.0
idna==2.7
oauthlib==2.1.0
Pillow==5.1.0
psycopg2==2.7.1
PyJWT==1.6.4
python-social-auth==0.3.6
python3-openid==3.1.0
pytz==2018.5
requests==2.19.1
requests-oauthlib==1.0.0
six==1.11.0
social-auth-app-django==1.1.0
social-auth-core==1.7.0
urllib3==1.23
whitenoise==3.2.1
这是我收到的错误消息:
from .oauth2_grants import SocialTokenGrant
File "/Users/user/Desktop/myvirtualenv/foodtasker/lib/python3.6/site-packages/rest_framework_social_oauth2/oauth2_grants.py", line 13, in <module>
from social.apps.django_app.views import NAMESPACE
ImportError: cannot import name 'NAMESPACE'
问题是如何解决此问题以及在哪里可以导入NAMESPACE。
答案 0 :(得分:0)
Django OAuth Toolkit尚不支持Django2.x。来自documentation:
要求
- Python 2.7、3.4、3.5、3.6
- Django 1.8、1.9、1.10、1.11
您可以将Django安装降级为1.11,以便能够使用Django OAuth Toolkit和django-rest-framework-social-oauth2。