add graphiql support

This commit is contained in:
cph 2016-10-22 14:16:06 +08:00
parent fcd483db31
commit 60b681d70d
2 changed files with 7 additions and 1 deletions

View File

@ -38,6 +38,9 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'graphene_django',
# a GUI for graphQL
'django_graphiql',
'cookbook.ingredients.apps.IngredientsConfig',
'cookbook.recipes.apps.RecipesConfig',

View File

@ -1,9 +1,12 @@
from django.conf.urls import url
from django.conf.urls import include
from django.views.decorators.csrf import csrf_exempt
from django.contrib import admin
from graphene_django.views import GraphQLView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^graphql', GraphQLView.as_view(graphiql=True)),
url(r'^graphql', csrf_exempt(GraphQLView.as_view(graphiql=True))),
url(r'^graphiql', include('django_graphiql.urls')),
]