Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
682 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
Graphene-Django | ||
=============== | ||
|
||
Contents: | ||
Welcome to the Graphene-Django docs. | ||
|
||
Graphene-Django is built on top of `Graphene <https://docs.graphene-python.org/en/latest/>`__. | ||
Graphene-Django provides some additional abstractions that make it easy to add GraphQL functionality to your Django project. | ||
|
||
First time? We recommend you start with the installation guide to get set up and the basic tutorial. | ||
It is worth reading the `core graphene docs <https://docs.graphene-python.org/en/latest/>`__ to familiarize yourself with the basic utilities. | ||
|
||
Core tenants | ||
------------ | ||
|
||
If you want to expose your data through GraphQL - read the ``Installation``, ``Schema`` and ``Queries`` section. | ||
|
||
|
||
For more advanced use, check out the Relay tutorial. | ||
|
||
.. toctree:: | ||
:maxdepth: 0 | ||
:maxdepth: 1 | ||
|
||
installation | ||
tutorial-plain | ||
tutorial-relay | ||
schema | ||
queries | ||
mutations | ||
filtering | ||
authorization | ||
debug | ||
rest-framework | ||
form-mutations | ||
introspection | ||
testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Installation | ||
============ | ||
|
||
Graphene-Django takes a few seconds to install and set up. | ||
|
||
Requirements | ||
------------ | ||
|
||
Graphene-Django currently supports the following versions of Django: | ||
|
||
* Django 2.X | ||
|
||
Installation | ||
------------ | ||
|
||
.. code:: bash | ||
pip install graphene-django | ||
**We strongly recommend pinning against a specific version of Graphene-Django because new versions could introduce breaking changes to your project.** | ||
|
||
Add ``graphene_django`` to the ``INSTALLED_APPS`` in the ``settings.py`` file of your Django project: | ||
|
||
.. code:: python | ||
INSTALLED_APPS = [ | ||
... | ||
'django.contrib.staticfiles', # Required for GraphiQL | ||
'graphene_django' | ||
] | ||
We need to add a graphql URL to the ``urls.py`` of your Django project: | ||
|
||
.. code:: python | ||
from django.conf.urls import url | ||
from graphene_django.views import GraphQLView | ||
urlpatterns = [ | ||
# ... | ||
url(r'^graphql$', GraphQLView.as_view(graphiql=True)), | ||
] | ||
(Change ``graphiql=True`` to ``graphiql=False`` if you do not want to use the GraphiQL API browser.) | ||
|
||
Finally, define the schema location for Graphene in the ``settings.py`` file of your Django project: | ||
|
||
.. code:: python | ||
GRAPHENE = { | ||
'SCHEMA': 'django_root.schema.schema' | ||
} | ||
Where ``path.schema.schema`` is the location of the ``Schema`` object in your Django project. | ||
|
||
The most basic ``schema.py`` looks like this: | ||
|
||
.. code:: python | ||
import graphene | ||
class Query(graphene.ObjectType): | ||
pass | ||
schema = graphene.Schema(query=Query) | ||
To learn how to extend the schema object for your project, read the basic tutorial. |
Oops, something went wrong.