django-app-graphql-1.9.9
1.9.9
1.9.8
1.9.7
1.9.6
1.9.5
1.9.4
1.9.3
1.9.26
1.9.25
1.9.24
1.9.23
1.9.22
1.9.21
1.9.20
1.9.2
1.9.19
1.9.18
1.9.17
1.9.16
1.9.15
1.9.14
1.9.13
1.9.12
1.9.11
1.9.10
1.9.1
1.9.0
1.8.9
1.8.8
1.8.7
1.8.6
1.8.5
1.8.4
1.8.3
1.8.2
1.8.12
1.8.11
1.8.10
1.8.1
1.8.0
1.7.0
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.0
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.11
1.4.10
1.4.1
1.4.0
1.30.9
1.30.8
1.30.7
1.30.6
1.30.5
1.30.3
1.30.2
1.30.14
1.30.13
1.30.12
1.30.11
1.30.10
1.30.1
1.30.0
1.3.0
1.29.3
1.29.2
1.29.1
1.29.0
1.28.0
1.27.1
1.27.0
1.26.3
1.26.2
1.26.1
1.26.0
1.25.8
1.25.7
1.25.6
1.25.2
1.25.1
1.25.0
1.24.0
1.23.0
1.22.0
1.21.5
1.21.3
1.21.2
1.21.1
1.20.0
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.13
1.2.12
1.2.11
1.2.10
1.19.0
1.18.57
1.18.56
1.18.55
1.18.54
1.18.53
1.18.52
1.18.51
1.18.50
1.18.49
1.18.48
1.18.47
1.18.46
1.18.45
1.18.44
1.18.43
1.18.42
1.18.41
1.18.4
1.18.3
1.18.2
1.18.1
1.18.0
1.17.0
1.16.0
1.15.0
1.14.9
1.14.8
1.14.7
1.14.6
1.14.5
1.14.4
1.14.3
1.14.2
1.14.12
1.14.11
1.14.1
1.14.0
1.13.3
1.13.2
1.13.1
1.13.0
1.12.1
1.12.0
توضیحات
Some stuff that i used when developing with django
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | django-app-graphql-1.9.9 |
| نام | django-app-graphql |
| نسخه کتابخانه | 1.9.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Massimo Bono |
| ایمیل نویسنده | massimobono1@gmail.com |
| آدرس صفحه اصلی | https://github.com/Koldar/django-koldar-common-apps |
| آدرس اینترنتی | https://pypi.org/project/django-app-graphql/ |
| مجوز | MIT |
Introduction
============
Django app that expose a graphql schema as well as a graphiql interface.
User
====
Installation
------------
.. code-block::
pip install django-app-graphql
Configuration
-------------
in ``INSTALLED_APPS`` you need to add:
.. code-block::
'graphene_django',
'django_filters',
**After all your apps you need to use this app** (this is important otherwise some models won't be detected at all!):
.. code-block::
'django_app_graphql',
The first thing you need to do is determine if you want your graphql server setupped
using ``graphene`` or using ``ariadne``. In settings, write:
.. code-block::
DJANGOAPPGRAPHQL = dict(
BACKENDTYPE="ariadne/graphene"
)
and select either *ariadne* or *graphene*.
Finally, in ``urls.py`` of the entire project add the following line:
.. code-block::
urlpatterns = [
...
path("graphqls/", include("django_app_graphql.urls")),
...
]
You have chosen graphene
^^^^^^^^^^^^^^^^^^^^^^^^
The app needs to be deploy for last because otherwise it cannot detect all the Django models and their types.
You also need to configure the authentication proces. Hence you need t add "AUTHENTICATION_BACKENDS" in the ``settings.py``\ :
.. code-block::
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django.contrib.auth.backends.ModelBackend"
]
After that, you need to properly configure the graphene, graphenedjango-extras and graphene-jwt. Add all these in your ``settings.py``\ :
.. code-block::
GRAPHENE = dict(
SCHEMA" = "django_app_graphql.graphene.schema.SCHEMA",
SCHEMA_OUTPUT = 'graphql-schema.json',
SCHEMA_INDENT = 2,
MIDDLEWARE = [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
"django_app_graphql.middleware.GraphQLStackTraceInErrorMiddleware",
],
)
GRAPHENE_DJANGO_EXTRAS = dict(
DEFAULT_PAGINATION_CLASS = 'graphene_django_extras.paginations.LimitOffsetGraphqlPagination',
DEFAULT_PAGE_SIZE = 20,
MAX_PAGE_SIZE = 50,
CACHE_ACTIVE = True,
CACHE_TIMEOUT = 300 # seconds
)
# see https://django-graphql-jwt.domake.io/en/latest/refresh_token.html
GRAPHQL_JWT = dict(
# This configures graphql-jwt to add "token" input at each request to be authenticated
JWT_ALLOW_ARGUMENT = True,
JWT_ARGUMENT_NAME = "token",
JWT_VERIFY_EXPIRATION = True,
JWT_EXPIRATION_DELTA = timedelta(minutes=30),
JWT_ALGORITHM = "HS256",
JWT_REFRESH_EXPIRATION_DELTA = timedelta(days=7),
JWT_AUTH_HEADER_PREFIX = "Bearer",
)
You have chosen ariadne
^^^^^^^^^^^^^^^^^^^^^^^
In ``settings.py`` add:
.. code-block::
INSTALLED_APPS = [
...
"ariadne.contrib.django",
]
Add templates (otherwise the playground won't work):
.. code-block::
TEMPLATES = [
{
...,
'APP_DIRS': True,
...
},
]
Ariadne is in unstable development (I don't know if it will ever be supported)
Generic tweaks
^^^^^^^^^^^^^^
Finally you can configure this app, for instance:
.. code-block::
DJANGO_APP_GRAPHQL = {
"BACKEND_TYPE": "graphene",
"EXPOSE_GRAPHIQL": True,
"GRAPHQL_SERVER_URL": "",
"ENABLE_GRAPHQL_FEDERATION": True,
"SAVE_GRAPHQL_SCHEMA": "output/schema.graphql"
}
Developer
=========
Update new version (only for developers)
========================================
You can use ``setuptools`` and ``twine``\ :
.. code-block::
python setup.py update_version_patch bdist_wheel
twine upload dist/*
Or you can use ``pmakeup``
.. code-block::
pmakeup update-version-patch build upload-to-pypi
نحوه نصب
نصب پکیج whl django-app-graphql-1.9.9:
pip install django-app-graphql-1.9.9.whl
نصب پکیج tar.gz django-app-graphql-1.9.9:
pip install django-app-graphql-1.9.9.tar.gz