美文网首页
django Authorization token

django Authorization token

作者: wangtieshan | 来源:发表于2017-10-31 16:40 被阅读0次

请求头中增加:

authorization = 'Token <Your token>'
req.add_header('Authorization', authorization)

问题: 'Token' has no attribute 'DoesNotExist'

原因:没有导入rest authon: 'rest_framework.authtoken',
解决方法:在 settings 里面 INSTALLED_APPS 中添加 'rest_framework.authtoken' 即可

问题:Exception Value: no such table: authtoken_token

执行:

python manage.py makemigrations
python manage.py migrate

更细一下表即可

相关文章

网友评论

      本文标题:django Authorization token

      本文链接:https://www.haomeiwen.com/subject/pqibpxtx.html