Installation¶
Basic usage¶
Add library to an existing Wagtail project:
pip install wagtail_grapple
Add the following to the INSTALLED_APPS
list in your Wagtail
settings file:
INSTALLED_APPS = [
# ...
"grapple",
"graphene_django",
# ...
]
Add the following to the bottom of the same settings file where each key is the app you want to this library to scan and the value is the prefix you want to give to GraphQL types (you can usually leave this blank):
# Grapple Config:
GRAPHENE = {"SCHEMA": "grapple.schema.schema"}
GRAPPLE = {
"APPS": ["home"],
}
Add the GraphQL URLs to your urls.py
:
from django.urls import path
from grapple import urls as grapple_urls
# ...
urlpatterns = [
# ...
path("", include(grapple_urls)),
# ...
]
Done! Now you can proceed onto configuring your models to generate GraphQL types that adopt their structure.
By default, Grapple uses these settings.
Next Steps
Your GraphQL endpoint is available at http://localhost:8000/graphql/