python - Django-Graphene: No module named 'graphql_jwt'
问题描述
I'm trying to implement authentication with Django and GraphQL/graphene
I've run into the error No module named 'graphql_jwt'.
and the solutions I've found don't seem to work
Reproducing
The code is available here:
https://github.com/altear/hello-GraphQL/tree/7ae1229b29f144f0f511d1b1a86edba36053dd86
git clone https://github.com/altear/hello-GraphQL.git
git checkout 7ae1229b29f144f0f511d1b1a86edba36053dd86
It uses docker-compose, so you should be able to run it with just docker-compose up -d --build
The error is immediately visible if you go to http://localhost:8000
What I've Tried
Other posts that have this error don't seem to be applicable:
- one mentions having another folder named "graphql" in the python path. But I use docker so my environment should be clean (there's nothing like that in the project dir)
- another mentions not having installed graphql. However, it's in my requirements.txt and it worked before I tried adding authentication
解决方案
用于 Django的graphql-jwt 模块以django-graphql-jwt
.
您必须将此作为显式依赖项添加到您的项目中,除非它是其他项目之一的传递依赖项(根据您的项目中的 requirements.txt 和我简要查看的 setup.py,它不是)。
推荐阅读
- c++ - 无法转换 'std::array
'在初始化时'浮动' - webpack - Vue-cli-3 “npm run build/watch”:我想要 WordPress 主题的相同 outputDir
- kubernetes - Filebeat 未发送所有容器日志
- java - 如何使用 RestFB 发布带有自定义缩略图的视频?
- java - 从 Java 客户端发送的命令在被 C++ 服务器端接收之前被分割成多个部分
- ios - TesseractOCR BAD_ACCESS
- javascript - 全局符号注册表和跨领域符号
- python - 如何在 Python 中使用 Zipfile 模块添加密码和输出目录?
- angular - 如何在 Angular 2 中实现个人“收藏夹列表”的可共享链接系统?
- java - 将 HashSet 的内容与地图进行比较