talebbits / wagtail-graphql

App to automatically add GraphQL support to a Wagtail website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wagtail-graphql

An app to automatically add graphql support to a Wagtail website

This Wagtail adds GraphQL 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. In particular, it makes minimal assumptions about the structure of the website to allow for a generic API.

Installing / Getting started

To install as a general app:

pip install wagtail-graphql

Add it together with graphene_django to the Django INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    
    'wagtail_graphql',
    'graphene_django',
    
    ...
]

Initial Configuration

Add the graphene schema GRAPHENE and a GRAPHQL_API dictionary.
Include all the Wagtail apps the library should generate bindings to APPS and optionally specify the prefix for each app in PREFIX. To remove a leading part of all the urls, specify the URL_PREFIX parameter.

GRAPHENE = {
    'SCHEMA': 'wagtail_graphql.schema.schema',
}

GRAPHQL_API = {
    'APPS': [
        'home'
    ],
    'PREFIX': {
        'home': ''
    },
    'URL_PREFIX': '/home'
}

The example above generates bindings for the home app. Every url in this example will be stripped of the initial /home substring.

Developing

To develop this library, download the source code and install a local version in your Wagtail website.

Features

This project is intended to require minimal configuration and interaction:

Contributing

If you'd like to contribute, please fork the repository and use a feature branch. Pull requests are welcome.

Links

Licensing

The code in this project is licensed under MIT license.

About

App to automatically add GraphQL support to a Wagtail website

License:MIT License


Languages

Language:Python 98.9%Language:HTML 1.1%