All Projects → graphql-python → Graphene Django

graphql-python / Graphene Django

Licence: mit
Integrate GraphQL into your Django project.

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Graphene Django

Best Of Web Python
🏆 A ranked list of awesome python libraries for web development. Updated weekly.
Stars: ✭ 1,118 (-70.09%)
Mutual labels:  graphql, django
Saleor
A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React.
Stars: ✭ 14,720 (+293.79%)
Mutual labels:  graphql, django
Ariadne
Ariadne is a Python library for implementing GraphQL servers using schema-first approach.
Stars: ✭ 1,274 (-65.92%)
Mutual labels:  graphql, django
Graphene
GraphQL framework for Python
Stars: ✭ 6,964 (+86.3%)
Mutual labels:  graphql, graphene
Graphene File Upload
Enhances Graphene Django GraphQL Server for intuitive file uploads via GraphQL mutations.
Stars: ✭ 210 (-94.38%)
Mutual labels:  graphql, django
Strawberry
A new GraphQL library for Python 🍓
Stars: ✭ 891 (-76.16%)
Mutual labels:  graphql, django
Crudl Example Django
CRUDL with Django, DRF/Graphene and SQLite
Stars: ✭ 113 (-96.98%)
Mutual labels:  graphql, django
Graphene Django Extras
Extras functionalities for Graphene-Django
Stars: ✭ 356 (-90.48%)
Mutual labels:  graphql, django
Django Graphql Auth
Django registration and authentication with GraphQL.
Stars: ✭ 200 (-94.65%)
Mutual labels:  graphql, django
Djangochannelsgraphqlws
Django Channels based WebSocket GraphQL server with Graphene-like subscriptions
Stars: ✭ 203 (-94.57%)
Mutual labels:  graphql, django
Django Graphql Jwt
JSON Web Token (JWT) authentication for Graphene Django
Stars: ✭ 649 (-82.64%)
Mutual labels:  graphql, django
Cms
Club Management System of amFOSS, powered by CMS
Stars: ✭ 263 (-92.96%)
Mutual labels:  graphql, django
Cookiecutter Django Vue
Cookiecutter Django Vue is a template for Django-Vue projects.
Stars: ✭ 462 (-87.64%)
Mutual labels:  graphql, django
Django Graph Api
Pythonic implementation of the GraphQL specification for the Django Web Framework.
Stars: ✭ 29 (-99.22%)
Mutual labels:  graphql, django
Django Api Domains
A pragmatic styleguide for Django API Projects
Stars: ✭ 365 (-90.24%)
Mutual labels:  graphql, django
Django Graphql Social Auth
Python Social Auth support for Graphene Django
Stars: ✭ 90 (-97.59%)
Mutual labels:  graphql, django
Graphene Django Subscriptions
This package adds support to Subscription's requests and its integration with websockets using Channels package.
Stars: ✭ 173 (-95.37%)
Mutual labels:  graphql, django
Cookiecutter Django Vue Graphql Aws
A highly opinionated Cookiecutter template that fuses together Django, Vue.js, GraphQL, and AWS into one full-stack web application.
Stars: ✭ 213 (-94.3%)
Mutual labels:  graphql, django
Gitlit
Platform to connect contributors and projects based on skill level and shared interests.
Stars: ✭ 265 (-92.91%)
Mutual labels:  graphql, django
Django Sitetree
Reusable application for Django introducing site tree, menu and breadcrumbs navigation elements.
Stars: ✭ 330 (-91.17%)
Mutual labels:  django

Graphene Logo Graphene-Django

A Django integration for Graphene.

build pypi Anaconda-Server Badge coveralls

💬 Join the community on Slack

Documentation

Visit the documentation to get started!

Quickstart

For installing graphene, just run this command in your shell

pip install "graphene-django>=3"

Settings

INSTALLED_APPS = (
    # ...
    'django.contrib.staticfiles', # Required for GraphiQL
    'graphene_django',
)

GRAPHENE = {
    'SCHEMA': 'app.schema.schema' # Where your Graphene schema lives
}

Urls

We need to set up a GraphQL endpoint in our Django app, so we can serve the queries.

from django.urls import path
from graphene_django.views import GraphQLView

urlpatterns = [
    # ...
    path('graphql', GraphQLView.as_view(graphiql=True)),
]

Examples

Here is a simple Django model:

from django.db import models

class UserModel(models.Model):
    name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)

To create a GraphQL schema for it you simply have to write the following:

from graphene_django import DjangoObjectType
import graphene

class User(DjangoObjectType):
    class Meta:
        model = UserModel

class Query(graphene.ObjectType):
    users = graphene.List(User)

    def resolve_users(self, info):
        return UserModel.objects.all()

schema = graphene.Schema(query=Query)

Then you can query the schema:

query = '''
    query {
      users {
        name,
        lastName
      }
    }
'''
result = schema.execute(query)

To learn more check out the following examples:

GraphQL testing clients

Contributing

See CONTRIBUTING.md

Release Notes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].