Skip to content

[DEPRECATED | Use graphene-django package] A django view that will execute a GraphQLSchema using a given Executor.

License

Notifications You must be signed in to change notification settings

GraphQL-python-archive/graphql-django-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphql-django-view

Build Status Coverage Status PyPI version

A django view that will execute a GraphQLSchema using a given Executor.

Usage

Use it like you would any other Django View.

urlpatterns = [
    url(r'^graphql', GraphQLView.as_view(schema=Schema)),
]

Supported options

  • schema: The GraphQLSchema object that you want the view to execute when it gets a valid request.
  • pretty: Whether or not you want the response to be pretty printed JSON.
  • executor: The Executor that you want to use to execute queries.
  • root_value: The root_value you want to provide to executor.execute.

You can also subclass GraphQLView and overwrite get_root_value(self, request) to have a dynamic root value per request.

class UserRootValue(GraphQLView):
    def get_root_value(self, request):
        return request.user

About

[DEPRECATED | Use graphene-django package] A django view that will execute a GraphQLSchema using a given Executor.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages