graphene-django

Build powerful, flexible GraphQL APIs with seamless Django integration.

Library
PyPI
v3.2.3
4,392stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
62/100Good
Development Activity32
Maintenance36
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture84
Code Quality80
Innovation78
Learning Curve74

Graphene-Django connects the Graphene GraphQL framework to Django, letting you expose your models, querysets, and forms as a GraphQL API. It maps Django models to GraphQL types, wires querysets into resolvers, and provides mutation and Relay connection helpers so you can build a schema without hand-writing boilerplate.

It ships a batteries-included GraphQL view with an in-browser GraphiQL IDE, integrates with Django REST Framework serializers and django-filter, and layers debugging and pagination on top of Graphene’s core, making it the standard way to serve GraphQL from a Django project.

What You Get

  • DjangoObjectType to auto-map Django models to GraphQL types
  • Queryset-backed fields and Relay-style connections with pagination
  • A configurable GraphQLView with a built-in GraphiQL IDE
  • Mutation helpers plus Django form and DRF serializer integration
  • django-filter integration for declarative filtering
  • A query debug middleware for inspecting SQL and resolver behavior

Common Use Cases

  • Exposing an existing Django data model as a GraphQL API
  • Building a Relay-compatible GraphQL backend for a React or mobile client
  • Adding filtered, paginated GraphQL queries over Django querysets
  • Reusing Django forms or DRF serializers to power GraphQL mutations

Under The Hood

Architecture - Graphene-Django is a Django app (graphene_django/) built on Graphene. types.py defines DjangoObjectType, which introspects a model via a registry.py to map fields through converter.py; fields.py supplies queryset-backed and connection fields; views.py implements the GraphQLView that parses requests, executes the schema, and renders GraphiQL. Optional sub-packages add filter/, forms/, rest_framework/, and debug/ integrations.

Tech Stack - Pure Python built on Graphene (graphql-core underneath) and Django, packaged with setuptools (setup.py/setup.cfg), tested across a Django/Python matrix via tox and pytest (conftest.py, tests/). Optional integrations depend on django-filter and Django REST Framework.

Code Quality - A mature, high-engagement project with an extensive tests/ package and pytest fixtures covering type conversion, connections, mutations, and views. The field-conversion logic is centralized and the codebase is cleanly split by concern, though recent release cadence has slowed.

API Design - Developer experience is strong: subclass DjangoObjectType, point it at a model, and fields are generated automatically, with GraphiQL available immediately for exploration. Relay connections, filtering, and mutations follow consistent, well-documented patterns, keeping the boilerplate for a working GraphQL endpoint minimal.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search