{"id":13532133,"url":"https://github.com/tr11/wagtail-graphql","last_synced_at":"2025-12-25T07:51:34.525Z","repository":{"id":45606359,"uuid":"159089142","full_name":"tr11/wagtail-graphql","owner":"tr11","description":"App to automatically add GraphQL support to a Wagtail website","archived":false,"fork":false,"pushed_at":"2021-02-08T04:42:55.000Z","size":134,"stargazers_count":38,"open_issues_count":9,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T17:42:03.468Z","etag":null,"topics":["graphene","graphql","wagtail","wagtail-apps","wagtail-graphql","wagtail-website"],"latest_commit_sha":null,"homepage":null,"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/tr11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-26T00:40:16.000Z","updated_at":"2023-11-07T12:50:13.000Z","dependencies_parsed_at":"2022-09-11T21:43:37.041Z","dependency_job_id":null,"html_url":"https://github.com/tr11/wagtail-graphql","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr11%2Fwagtail-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr11%2Fwagtail-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr11%2Fwagtail-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tr11%2Fwagtail-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tr11","download_url":"https://codeload.github.com/tr11/wagtail-graphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"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":["graphene","graphql","wagtail","wagtail-apps","wagtail-graphql","wagtail-website"],"created_at":"2024-08-01T07:01:08.444Z","updated_at":"2025-12-25T07:51:34.489Z","avatar_url":"https://github.com/tr11.png","language":"Python","funding_links":[],"categories":["Apps"],"sub_categories":["Misc"],"readme":"\u003cimg src=\"https://wagtail.io/static/img/wagtail.dbf60545a188.svg\" height=\"100px\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003cimg src=\"https://graphql.org/img/logo.svg\" height=\"100px\"\u003e\n\u003chr/\u003e\n\n# wagtail-graphql\n\u003e An app to automatically add GraphQL support to a Wagtail website\n\nThis [Wagtail](https://wagtail.io/) app adds [GraphQL](https://graphql.org/) types to other Wagtail apps. The objective is for this library to interact with an existing website in a generic way and with minimal effort.\nIn particular, it makes minimal assumptions about the structure of the website\nto allow for a generic API.\n\n## Installing / Getting started\n\nTo install as a general app:\n\n```shell\npip install wagtail-graphql\n```\n\nAdd it together with [graphene_django](https://github.com/graphql-python/graphene-django) to the Django INSTALLED_APPS:\n\n```python\nINSTALLED_APPS = [\n    ...\n    'wagtail_graphql',\n    'graphene_django',\n    ...\n]\n\n```\n\n### Initial Configuration\n\nAdd the required [graphene](https://github.com/graphql-python/graphene) schema `GRAPHENE` and a `GRAPHQL_API` dictionary.\nInclude all the Wagtail apps the library should generate bindings to in the `APPS` list and optionally specify the prefix for each app in `PREFIX`. To remove a leading part of all the urls for a specific site, specify the `URL_PREFIX` parameter for each needed host.\n\n```python\nGRAPHENE = {\n    'SCHEMA': 'wagtail_graphql.schema.schema',\n}\n\nGRAPHQL_API = {\n    'APPS': [\n        'home'\n    ],\n    'PREFIX': {\n        'home': ''        # optional, prefix for all the app classes generated by the wrapper\n    },\n    'URL_PREFIX': {\n        'localhost': '/home'   # optional, read from the site information if not specified \n    }\n}\n```\nThe example above generates bindings for the `home` app, .  Every url in this example\nwill be stripped of the initial `/home` substring.\n\nFinally, set up the GraphQL views in the project `urls.py`.\nFor example, to add two endpoints for GraphQL and the [GraphiQL](https://github.com/graphql/graphiql) IDE: \n\n```python\nfrom django.views.decorators.csrf import csrf_exempt\nfrom graphene_django.views import GraphQLView\n\nurlpatterns = [\n    ...\n    url(r'^api/graphql', csrf_exempt(GraphQLView.as_view())),\n    url(r'^api/graphiql', csrf_exempt(GraphQLView.as_view(graphiql=True, pretty=True)),\n    ...\n]\n```\nNote that the urls above need to appear before the `wagtail_urls` catchall entry.\n\n#### Images\n\nTo be able to generate urls for images the following also needs to be included in the project's `urls.py`:\n\n```python\nfrom wagtail.images.views.serve import ServeView\n\nurlpatterns = [\n    ...\n    url(r'^images/([^/]*)/(\\d*)/([^/]*)/[^/]*$', ServeView.as_view(), name='wagtailimages_serve'),\n    ...\n]\n```\n\n\n### Multi-site configuration\nThis library works transparently with a multi-site Wagtail install without any extra configuration required.  To strip a custom leading prefix for each site, specify each host in the `URL_PREFIX`.  For exaple, for two hosts `host1.example.com` and `host2.example.com`:\n\n```\nGRAPHQL_API = {\n    ...\n    'URL_PREFIX': {\n        'host1.example.com': '/prefix1',\n        'host2.example.com': '/prefix2'\n    }\n    ...\n}\n```\nNote that the prefix for a site is taken from the root page url if a host is not included in the `URL_PREFIX` dictionary. \n\n\n## Developing\n\nTo develop this library, download the source code and install a local version in your Wagtail website.\n\n\n## Features\n\nThis project is intended to require minimal configuration and interaction. It currently supports \n\n* [Page models](https://docs.wagtail.io/en/master/topics/pages.html)\n* [Snippets](https://docs.wagtail.io/en/master/topics/snippets.html)\n* Images\n* Documents\n* [StreamFields](https://docs.wagtail.io/en/master/topics/streamfield.html) with [Basic Blocks](https://docs.wagtail.io/en/naster/topics/streamfield.html#basic-block-types) and [StructBlocks](https://docs.wagtail.io/en/master/topics/streamfield.html#structblock) \n \n\n## Contributing\n\nIf you'd like to contribute, please fork the repository and use a feature\nbranch. Pull requests are welcome.\n\n## Links\n\n- Repository: https://github.com/tr11/wagtail-graphql\n- Issue tracker: https://github.com/tr11/wagtail-graphql/issues\n\n## Licensing\n\nThe code in this project is licensed under MIT license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftr11%2Fwagtail-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftr11%2Fwagtail-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftr11%2Fwagtail-graphql/lists"}