Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Adds GraphQL support to your Flask application

Project description

Build Status Coverage Status PyPI version

Adds GraphQL support to your Flask application.


Just create a GraphQL instance from graphql_flask

from graphql_flask import GraphQL

graphql_blueprint = GraphQL(app, schema=schema)

This will add /graphql and /graphiql endpoints to your app.


This package provides the following Views: * GraphQLView: endpoint for expose the GraphQL schema * GraphiQLView: Graphical Interface for operate with GraphQL easily

You can also add only the views you want to use:

from graphql_flask import GraphQLView, GraphiQLView

app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema))

Supported options

  • schema: The GraphQLSchema object that you want the view to execute when it gets a valid request.
  • pretty: Whether or not you want the response to be pretty printed JSON.
  • executor: The Executor that you want to use to execute queries.
  • root_value: The root_value you want to provide to executor.execute.
  • default_query: The default_query you want to provide to GraphiQL interface.

You can also subclass GraphQLView and overwrite get_root_value(self, request) to have a dynamic root value per request.

class UserRootValue(GraphQLView):
    def get_root_value(self, request):
        return request.user

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for graphql-flask, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size graphql-flask-1.0.0.tar.gz (167.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page