【问题标题】:Import (cannot import name 'ResolveInfo' from 'graphql') error when using newest graphene and graphene-django version使用最新的石墨烯和石墨烯-django 版本时出现导入(无法从“graphql”导入名称“ResolveInfo”)错误
【发布时间】:2020-04-22 05:28:52
【问题描述】:

自从更新我的依赖项后,我的 django 应用程序出现了一些问题。 这是我安装的应用程序:

INSTALLED_APPS = [
    'graphene_django',
    'rest_framework',
    'corsheaders',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'dojo_manager.dojo',
]

还有我的 requirements.txt:

aniso8601==8.0.0   
asgiref==3.2.3   
Django==3.0.2   
django-cors-headers==3.2.0   
django-filter==2.2.0   
django-graphql-jwt==0.3.0   
djangorestframework==3.11.0   
djangorestframework-jwt==1.11.0   
graphene==2.1.8   
graphene-django==2.8.0   
graphene-django-extras==0.4.8   
graphql-core==3.0.1   
graphql-relay==3.0.0   
pip-upgrade-outdated==1.5   
pipupgrade==1.5.2   
promise==2.3   
PyJWT==1.7.1   
python-dateutil==2.8.1   
pytz==2019.3   
Rx==3.0.1   
singledispatch==3.4.0.3   
six==1.13.0   
sqlparse==0.3.0   

我来了

ImportError: cannot import name 'ResolveInfo' from 'graphql' (E:\Ben\GitHub-Repos\dojo-manager\env\lib\site-packages\graphql\__init__.py)

我知道 https://github.com/graphql-python/graphene-django/issues/737https://github.com/graphql-python/graphene/issues/546 ,在我的情况下似乎都没有解决它。

非常感谢任何帮助。

【问题讨论】:

    标签: python django graphql


    【解决方案1】:

    好的,我可以通过将graphql-core==3.0.1 降级为graphql-core<3(以及所有依赖项)来修复它。

    我在执行pip install -r requirements.txt时一定错过了错误

    【讨论】:

    • get_introspection_query 遇到了同样的问题。谢谢!
    猜你喜欢
    • 2017-05-11
    • 2020-07-27
    • 2017-05-13
    • 2020-02-14
    • 2018-01-11
    • 2020-09-01
    • 2019-04-03
    • 2020-01-08
    • 2018-03-11
    相关资源
    最近更新 更多