{"id":13415543,"url":"https://github.com/graphql-python/graphene-django","last_synced_at":"2025-05-13T15:07:09.190Z","repository":{"id":37677450,"uuid":"68483365","full_name":"graphql-python/graphene-django","owner":"graphql-python","description":"Build powerful, efficient, and flexible GraphQL APIs with seamless Django integration.","archived":false,"fork":false,"pushed_at":"2025-04-30T04:30:17.000Z","size":1350,"stargazers_count":4356,"open_issues_count":164,"forks_count":765,"subscribers_count":68,"default_branch":"main","last_synced_at":"2025-05-13T00:01:56.178Z","etag":null,"topics":["django","graphene","graphql","python"],"latest_commit_sha":null,"homepage":"http://docs.graphene-python.org/projects/django/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-python.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-17T23:26:25.000Z","updated_at":"2025-05-09T02:59:16.000Z","dependencies_parsed_at":"2023-02-08T21:15:26.036Z","dependency_job_id":"1bdfc36e-c872-4649-9f4a-d0400512367e","html_url":"https://github.com/graphql-python/graphene-django","commit_stats":{"total_commits":783,"total_committers":226,"mean_commits":"3.4646017699115044","dds":0.8582375478927203,"last_synced_commit":"28c71c58f73e969bc05ebfdde06f578dd96e15d5"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-python%2Fgraphene-django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-python%2Fgraphene-django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-python%2Fgraphene-django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-python%2Fgraphene-django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-python","download_url":"https://codeload.github.com/graphql-python/graphene-django/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969226,"owners_count":21992262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","graphene","graphql","python"],"created_at":"2024-07-30T21:00:50.143Z","updated_at":"2025-05-13T15:07:09.171Z","avatar_url":"https://github.com/graphql-python.png","language":"Python","readme":"# ![Graphene Logo](http://graphene-python.org/favicon.png) Graphene-Django\n\n[![build][build-image]][build-url]\n[![pypi][pypi-image]][pypi-url]\n[![Anaconda-Server Badge][conda-image]][conda-url]\n[![coveralls][coveralls-image]][coveralls-url]\n\n[build-image]: https://github.com/graphql-python/graphene-django/workflows/Tests/badge.svg\n[build-url]: https://github.com/graphql-python/graphene-django/actions\n[pypi-image]: https://img.shields.io/pypi/v/graphene-django.svg?style=flat\n[pypi-url]: https://pypi.org/project/graphene-django/\n[coveralls-image]: https://coveralls.io/repos/github/graphql-python/graphene-django/badge.svg?branch=master\n[coveralls-url]: https://coveralls.io/github/graphql-python/graphene-django?branch=master\n[conda-image]: https://img.shields.io/conda/vn/conda-forge/graphene-django.svg\n[conda-url]: https://anaconda.org/conda-forge/graphene-django\n\nGraphene-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.\n\n## Features\n\n* Seamless integration with Django models\n* Automatic generation of GraphQL schema\n* Integration with Django's authentication and permission system\n* Easy querying and filtering of data\n* Support for Django's pagination system\n* Compatible with Django's form and validation system\n* Extensive documentation and community support\n\n## Installation\n\nTo install Graphene-Django, run the following command:\n\n```sh\npip install graphene-django\n```\n\n## Configuration\n\nAfter installation, add 'graphene_django' to your Django project's `INSTALLED_APPS` list and define the GraphQL schema in your project's settings:\n\n```python\nINSTALLED_APPS = [\n    # ...\n    'graphene_django',\n]\n\nGRAPHENE = {\n    'SCHEMA': 'myapp.schema.schema'\n}\n```\n\n## Usage\n\nTo use Graphene-Django, create a `schema.py` file in your Django app directory and define your GraphQL types and queries:\n\n```python\nimport graphene\nfrom graphene_django import DjangoObjectType\nfrom .models import MyModel\n\nclass MyModelType(DjangoObjectType):\n    class Meta:\n        model = MyModel\n\nclass Query(graphene.ObjectType):\n    mymodels = graphene.List(MyModelType)\n\n    def resolve_mymodels(self, info, **kwargs):\n        return MyModel.objects.all()\n\nschema = graphene.Schema(query=Query)\n```\n\nThen, expose the GraphQL API in your Django project's `urls.py` file:\n\n```python\nfrom django.urls import path\nfrom graphene_django.views import GraphQLView\nfrom . import schema\n\nurlpatterns = [\n    # ...\n    path('graphql/', GraphQLView.as_view(graphiql=True)), # Given that schema path is defined in GRAPHENE['SCHEMA'] in your settings.py\n]\n```\n\n## Testing\n\nGraphene-Django provides support for testing GraphQL APIs using Django's test client. To create tests, create a `tests.py` file in your Django app directory and write your test cases:\n\n```python\nfrom django.test import TestCase\nfrom graphene_django.utils.testing import GraphQLTestCase\nfrom . import schema\n\nclass MyModelAPITestCase(GraphQLTestCase):\n    GRAPHENE_SCHEMA = schema.schema\n\n    def test_query_all_mymodels(self):\n        response = self.query(\n            '''\n            query {\n                mymodels {\n                    id\n                    name\n                }\n            }\n            '''\n        )\n\n        self.assertResponseNoErrors(response)\n        self.assertEqual(len(response.data['mymodels']), MyModel.objects.count())\n```\n\n## Contributing\n\nContributions to Graphene-Django are always welcome! To get started, check the repository's [issue tracker](https://github.com/graphql-python/graphene-django/issues) and [contribution guidelines](https://github.com/graphql-python/graphene-django/blob/main/CONTRIBUTING.md).\n\n## License\n\nGraphene-Django is released under the [MIT License](https://github.com/graphql-python/graphene-django/blob/main/LICENSE).\n\n## Resources\n\n* [Official GitHub Repository](https://github.com/graphql-python/graphene-django)\n* [Graphene Documentation](http://docs.graphene-python.org/en/latest/)\n* [Django Documentation](https://docs.djangoproject.com/en/stable/)\n* [GraphQL Specification](https://spec.graphql.org/)\n* [GraphiQL](https://github.com/graphql/graphiql) - An in-browser IDE for exploring GraphQL APIs\n* [Graphene-Django Community](https://spectrum.chat/graphene) - Join the community to discuss questions and share ideas related to Graphene-Django\n\n## Tutorials and Examples\n\n* [Official Graphene-Django Tutorial](https://docs.graphene-python.org/projects/django/en/latest/tutorial-plain/)\n* [Building a GraphQL API with Django and Graphene-Django](https://www.howtographql.com/graphql-python/0-introduction/)\n* [Real-world example: Django, Graphene, and Relay](https://github.com/graphql-python/swapi-graphene)\n\n## Related Projects\n\n* [Graphene](https://github.com/graphql-python/graphene) - A library for building GraphQL APIs in Python\n* [Graphene-SQLAlchemy](https://github.com/graphql-python/graphene-sqlalchemy) - Integration between Graphene and SQLAlchemy, an Object Relational Mapper (ORM) for Python\n* [Graphene-File-Upload](https://github.com/lmcgartland/graphene-file-upload) - A package providing an Upload scalar for handling file uploads in Graphene\n* [Graphene-Subscriptions](https://github.com/graphql-python/graphene-subscriptions) - A package for adding real-time subscriptions to Graphene-based GraphQL APIs\n\n## Support\n\nIf you encounter any issues or have questions regarding Graphene-Django, feel free to [submit an issue](https://github.com/graphql-python/graphene-django/issues/new) on the official GitHub repository. You can also ask for help and share your experiences with the Graphene-Django community on [💬 Discord](https://discord.gg/Fftt273T79)\n\n## Release Notes\n\n* See [Releases page on github](https://github.com/graphql-python/graphene-django/releases)\n","funding_links":[],"categories":["Third-Party Packages","Python","Libraries","API","Best Django Admin Interface Resources","Implementations","GraphQL Utilities","GraphQL"],"sub_categories":["APIs","Python Libraries","**🖥️ Django REST Framework \u0026 API-Related Packages**","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-python%2Fgraphene-django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-python%2Fgraphene-django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-python%2Fgraphene-django/lists"}