Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Build Status Coverage Status PyPI version

Adds GraphQL support to your Flask application.

Usage

Just use the GraphQLView view from flask_graphql

from flask_graphql import GraphQLView

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

# Optional, for adding batch query support (used in Apollo-Client)
app.add_url_rule('/graphql/batch', view_func=GraphQLView.as_view('graphql', schema=schema, batch=True))

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

Supported options

  • schema: The GraphQLSchema object that you want the view to execute when it gets a valid request.

  • context: A value to pass as the context to the graphql() function.

  • root_value: The root_value you want to provide to executor.execute.

  • pretty: Whether or not you want the response to be pretty printed JSON.

  • executor: The Executor that you want to use to execute queries.

  • graphiql: If True, may present GraphiQL when loaded directly from a browser (a useful tool for debugging and exploration).

  • graphiql_template: Inject a Jinja template string to customize GraphiQL.

  • batch: Set the GraphQL view as batch (for using in Apollo-Client or ReactRelayNetworkLayer)

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

Release files for Flask-GraphQL 2.0rc0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-GraphQL 2.0rc0
File Size Uploaded
Flask-GraphQL-2.0rc0.tar.gz 6.5 kB Details

Release files / Flask-GraphQL-2.0rc0.tar.gz

Download URL Flask-GraphQL-2.0rc0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0e54ed00e1a2c5ccd957a024ecd1932a212efe879f840328a44c4fea3b033c98
BLAKE2b-256 checksum
How to use checksums
dd56a97707575b2768d362b368a7cd86dc4d9342f2fbc344374b77adc772078c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.0.1

1 release file

2.0.0

1 release file

This release

2.0rc0 This release

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page