graphene-django or: How I learned to stop RESTing and Love the Graph

Friday 5:31 pm

About This Talk

Though controversial, people generally agree that a major value of Python type hints is safety. Robust type safety reduces a whole category of defect to nothing, allowing developers to focus on bigger problems. What if we could do this for our API calls?

GraphQL provides not just a query language, but a type system. The producer and consumer are both aware of the type schema, enabling a boost in productivity at an integration point where mistakes commonly occur. Django has long been a full stack engine at its core, and then a RESTful API engine with the wide adoption of django-rest framework. Where can it go next?

The graphene-django package enables a Django project to provide a GraphQL endpoint built from its models. Using a declarative style most Djangonauts will find beautifully familiar, graphene-django helps developers spin up APIs quickly for consumption by client-side GraphQL consumers like Apollo.

If you attend this talk, you’ll come away having learned:

  • How GraphQL compares to REST
  • Why this approach can help you maintain loose coupling between teams
  • How to build GraphQL types on top of your Django models
  • How to provide a schema that resolves queries to model fields
  • How to try your new API out in the browser


    Dane Hillard

    I like leveraging software development skills for good. During my short career I’ve had a chance to work in the fields of counterterrorism, cancer research, and education. I’m an unrepentant foodie—read more about the upcoming Piquant if you like. I made a music album once and I make fashion and portraiture photography here and there.