Package: graphene-django
Graphene-DjangoGraphene-Django is an open-source library that provides seamless integration between Django, a high-level Python web framework, and Graphene, a library for building GraphQL APIs. The library allows developers to create GraphQL APIs in Django quickly and efficiently while maintaining a high level of performance.FeaturesSeamless integration with Django modelsAutomatic generation of GraphQL schemaIntegration with Django's authentication and permission systemEasy querying and filtering of dataSupport for Django's pagination systemCompatible with Django's form and validation systemExtensive documentation and community supportInstallationTo install Graphene-Django, run the following command:pip install graphene-djangoConfigurationAfter installation, add 'graphene_django' to your Django project'sINSTALLED_APPSlist and define the GraphQL schema in your project's settings:INSTALLED_APPS=[# ...'graphene_django',]GRAPHENE={'SCHEMA':'myapp.schema.schema'}UsageTo use Graphene-Django, create aschema.pyfile in your Django app directory and define your GraphQL types and queries:importgraphenefromgraphene_djangoimportDjangoObjectTypefrom.modelsimportMyModelclassMyModelType(DjangoObjectType):classMeta:model=MyModelclassQuery(graphene.ObjectType):mymodels=graphene.List(MyModelType)defresolve_mymodels(self,info,**kwargs):returnMyModel.objects.all()schema=graphene.Schema(query=Query)Then, expose the GraphQL API in your Django project'surls.pyfile:fromdjango.urlsimportpathfromgraphene_django.viewsimportGraphQLViewfrom.importschemaurlpatterns=[# ...path('graphql/',GraphQLView.as_view(graphiql=True)),# Given that schema path is defined in GRAPHENE['SCHEMA'] in your settings.py]TestingGraphene-Django provides support for testing GraphQL APIs using Django's test client. To create tests, create atests.pyfile in your Django app directory and write your test cases:fromdjango.testimportTestCasefromgraphene_django.utils.testingimportGraphQLTestCasefrom.importschemaclassMyModelAPITestCase(GraphQLTestCase):GRAPHENE_SCHEMA=schema.schemadeftest_query_all_mymodels(self):response=self.query('''query {mymodels {idname}}''')self.assertResponseNoErrors(response)self.assertEqual(len(response.data['mymodels']),MyModel.objects.count())ContributingContributions to Graphene-Django are always welcome! To get started, check the repository'sissue trackerandcontribution guidelines.LicenseGraphene-Django is released under theMIT License.ResourcesOfficial GitHub RepositoryGraphene DocumentationDjango DocumentationGraphQL SpecificationGraphiQL- An in-browser IDE for exploring GraphQL APIsGraphene-Django Community- Join the community to discuss questions and share ideas related to Graphene-DjangoTutorials and ExamplesOfficial Graphene-Django TutorialBuilding a GraphQL API with Django and Graphene-DjangoReal-world example: Django, Graphene, and RelayRelated ProjectsGraphene- A library for building GraphQL APIs in PythonGraphene-SQLAlchemy- Integration between Graphene and SQLAlchemy, an Object Relational Mapper (ORM) for PythonGraphene-File-Upload- A package providing an Upload scalar for handling file uploads in GrapheneGraphene-Subscriptions- A package for adding real-time subscriptions to Graphene-based GraphQL APIsSupportIf you encounter any issues or have questions regarding Graphene-Django, feel free tosubmit an issueon the official GitHub repository. You can also ask for help and share your experiences with the Graphene-Django community on💬 DiscordRelease NotesSeeReleases page on github