---
title: "Flask-GraphQL | pypx"
description: "Adds GraphQL support to your Flask application"
canonical_url: "https://pypx.app/packages/Flask-GraphQL"
meta:
  "og:description": "Adds GraphQL support to your Flask application"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_Flask-GraphQL%2Cversion_2.0.1%2Csummary_Adds%2BGraphQL%2Bsupport%2Bto%2Byour%2BFlask%2Bapplication%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9GbGFzay1HcmFwaFFMIg%2Cs_Yyf506l8m4SBrsI7.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Flask-GraphQL 2.0.1"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_Flask-GraphQL%2Cversion_2.0.1%2Csummary_Adds%2BGraphQL%2Bsupport%2Bto%2Byour%2BFlask%2Bapplication%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9GbGFzay1HcmFwaFFMIg%2Cs_Yyf506l8m4SBrsI7.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **Flask-GraphQL**

v2.0.1

Adds GraphQL support to your Flask application

6 KBMIT License Likely Unmaintained

[** Diff **](https://pypx.app/packages/Flask-GraphQL/diff)

`$ uv add Flask-GraphQL`

# Flask-GraphQL

Adds GraphQL support to your Flask application.

## Usage

Just use the GraphQLView view from flask\_graphql

```python
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](https://github.com/graphql/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](http://dev.apollodata.com/core/network.html#query-batching)\_ or [ReactRelayNetworkLayer](https://github.com/nodkz/react-relay-network-layer)\_)

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

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

## **Details **

<dl>

<dt>Version</dt>
<dd>2.0.1</dd>

<dt>License</dt>
<dd>MIT License</dd>

<dt>Maintainer</dt>
<dd>Syrus Akbary</dd></dl>

## **Links**

- [Download](https://github.com/graphql-python/flask-graphql/releases)
- [Homepage](https://github.com/graphql-python/flask-graphql)
- [View on PyPI](https://pypi.org/project/Flask-GraphQL/)

## **Maintainers **

- Syrus Akbary · [me@syrusakbary.com](mailto:me@syrusakbary.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/flask-graphql#webpage","@type":"WebPage","description":"Adds GraphQL support to your Flask application","name":"Flask-GraphQL","url":"https://pypx.app/packages/flask-graphql","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/flask-graphql"]}]},{"@id":"https://pypx.app/packages/flask-graphql#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Adds GraphQL support to your Flask application","license":"MIT License","name":"Flask-GraphQL","softwareVersion":"2.0.1"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
