It seems like upgrading graphene to v3 has broken the compatibility of flask-graphql. Here is the traceback:
File "C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\flask\cli.py", line 240, in locate_app
__import__(module_name)
File "D:\aap\aap\app.py", line 3, in <module>
from flask_graphql import GraphQLView
File "C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\flask_graphql\__init__.py", line 1, in <module>
from .blueprint import GraphQL
File "C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\flask_graphql\blueprint.py", line 5, in <module>
from .graphqlview import GraphQLView
File "C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\flask_graphql\graphqlview.py", line 7, in <module>
from graphql_server import (HttpQueryError, default_format_error,
File "C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\graphql_server\__init__.py", line 18, in <module>
from graphql import get_default_backend
ImportError: cannot import name 'get_default_backend' from 'graphql' (C:\Users\Admin\.conda\envs\pnd-graphene-3\lib\site-packages\graphql\__init__.py)
Edit: Add minimal code to reproduce
from graphene import ObjectType, String, Schema
from flask import Flask
from flask_graphql import GraphQLView
class Query(ObjectType):
work_plz = String()
def resolve_work_plz(root, info):
return 'It worked'
schema = Schema(query=Query)
app = Flask(__name__)
app.add_url_rule('/graphql', view_func=GraphQLView.as_view(
'graphql',
schema=schema,
graphiql=True,
))
if __name__ == '__main__':
app.run()
It seems like upgrading graphene to v3 has broken the compatibility of flask-graphql. Here is the traceback:
Edit: Add minimal code to reproduce
I'm currently using: