首页 > 解决方案 > 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:

标签: pythondjangographql

解决方案


用于 Django的graphql-jwt 模块django-graphql-jwt.

您必须将此作为显式依赖项添加到您的项目中,除非它是其他项目之一的传递依赖项(根据您的项目中的 requirements.txt 和我简要查看的 setup.py,它不是)。


推荐阅读