graphene-django
Graphene Django integration
What it is and what it does
Graphene-Django is a bridge library that lets you build GraphQL APIs directly from your Django models without writing boilerplate schema definitions. It sits between Django and graphene, automatically converting your Django model structure into a queryable GraphQL schema and wiring in Django's built-in authentication, permissions, and form validation.
You define your GraphQL types by wrapping Django models in DjangoObjectType classes, then expose them through a schema that graphene-django serves via a Django view. The library handles common tasks like filtering, pagination, and permission checks, so you spend less time on API plumbing and more on business logic. It's designed for developers already working in Django who want to add a GraphQL layer without learning a separate API framework.
Use it for:
- Expose existing Django models as a GraphQL API without rewriting model definitions or authentication logic
- Build a modern frontend backed by a Django GraphQL endpoint with automatic schema introspection
- Add filtering and pagination to Django querysets via GraphQL without custom resolver code
- Migrate from REST to GraphQL incrementally by wrapping Django views and models in GraphQL types
- Test GraphQL queries against Django models using the built-in GraphQLTestCase utility
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Graphene-Django bridges Django models and GraphQL APIs, automatically generating GraphQL schemas from Django models and integrating with Django's authentication, permissions, and validation systems.
Yes. Graphene-Django is actively maintained, has no known vulnerabilities, and low install friction. It's the standard choice for adding GraphQL to Django projects. Install it if you're building a GraphQL API on top of Django models and want to avoid manual schema definition and boilerplate.
Install
graphene-django on PyPI
pip
pip install graphene-djangouv
uv add graphene-djangopoetry
poetry add graphene-djangoInstalling graphene-django
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits and a large repository (4392 stars), indicating stable, community-backed development.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects without licensing concerns.
Quickstart
pip install graphene-django
# In settings.py:
INSTALLED_APPS = ['graphene_django']
GRAPHENE = {'SCHEMA': 'myapp.schema.schema'}
# In schema.py:
import graphene
from graphene_django import DjangoObjectType
class MyType(DjangoObjectType):
class Meta:
model = MyModel
class Query(graphene.ObjectType):
items = graphene.List(MyType)
def resolve_items(self, info):
return []
schema = graphene.Schema(query=Query)
Requires Django to be installed and configured; GraphQL queries execute against your Django ORM, so database setup is a prerequisite.
Verify before relying
- Performance characteristics under high query load or with large datasets
- Compatibility with Django versions beyond 4.2
- Real-world scalability limits for complex nested queries
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — graphene, graphql-core, graphql-relay, Django, promise, text-unidecode |
| Maintenance | actively maintained — 519 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,188,603/month — #4,244 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: graphene_django-3.2.3-py2.py3-none-any.whl
Keywords: api, graphql, protocol, rest, relay, graphene
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
grapheneGraphene is a Python library for building…
permissive · top 1,000 on PyPI
graphene-django-optimizerAutomatically optimizes GraphQL queries…
permissive · top 15,000 on PyPI
graphene-file-uploadAdds file upload support to GraphQL mutations…
permissive · top 15,000 on PyPI
django-graphql-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
graphene-sqlalchemyGraphene-SQLAlchemy exposes SQLAlchemy database…
permissive · top 15,000 on PyPI
graphene-federationAdds Apollo Federation support to Graphene…
permissive · top 15,000 on PyPI
strawberry-graphql-djangoGenerates GraphQL types, queries, mutations,…
permissive · top 5,000 on PyPI
starlette-graphene3Mounts a GraphQL API built with Graphene v3…
permissive · top 15,000 on PyPI
graphene-pydanticConverts Pydantic models into GraphQL object…
permissive · top 15,000 on PyPI
Flask-GraphQLAdds a GraphQL endpoint to Flask applications,…
permissive · top 15,000 on PyPI