Update middleware.rst

I think a description of where the Middleware needs to go to be executed every time would be useful. It would have saved me some time.
This commit is contained in:
Daniele Bernardini 2018-08-29 12:31:26 +02:00 committed by GitHub
parent d728b84e48
commit 9327ef4d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,18 @@ And then execute it with:
result = schema.execute('THE QUERY', middleware=[AuthorizationMiddleware()])
Or set it up in the default middleware to be executed for every query in settings.py:
.. code:: python
GRAPHENE = {
'SCHEMA': 'my_app.schema.schema'
'MIDDLEWARE': (
'graphene_django.debug.DjangoDebugMiddleware',
'mymodule.AuthorizationMiddleware'
)
}
Functional example
------------------
@ -69,3 +81,4 @@ And then execute it with:
.. code:: python
result = schema.execute('THE QUERY', middleware=[timing_middleware])