This is a project to auto generate a graphql crud using graphene django
Project description
Graphene CRUD Maker
This is a project to auto generate a graphql crud using graphene django
Requirements
- Python >= 3.6
- Django >= 2.2
- Graphene Django >= 2.0
Quick start
Installation
pip install graphene-crud-maker
Create a Django project
django-admin startproject core .
Add "graphene_crud_maker" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'graphene_crud_maker',
]
Add GRAPHENE to your settings.py
define the schema location for Graphene in the settings.py file of your Django project:
link: https://docs.graphene-python.org/projects/django/en/latest/
GRAPHENE = {
"ATOMIC_MUTATIONS": True,
'SCHEMA': 'Core.schema.schema.schema',
"SCHEMA_INDENT": 4,
"MIDDLEWARE": [
"graphene_django.debug.DjangoDebugMiddleware",
'graphql_jwt.middleware.JSONWebTokenMiddleware',
]
}
Add URLS to your urls.py
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt
from graphql_jwt.decorators import jwt_cookie
from graphene_django.views import GraphQLView
urlpatterns = [
# ...
url(r"graphql", csrf_exempt(jwt_cookie(GraphQLView.as_view(graphiql=True)))),
]
Create the app
python3 manage.py startapp myapp
Note: create models
Usage
Python
python3 manage.py maker --help
Output
Create Graphene CRUD
optional arguments:
-h, --help show this help message and exit
-n NAME, --name NAME App name to create the CRUD graphQL
-e [EXCLUDE ...], --exclude [EXCLUDE ...]
Fields to exclude in the CRUD (id, createdAt, updatedAt)
...
Command to create GraphQL
python3 manage.py maker -n myapp
Run the server
python3 manage.py runserver
GraphiQL
http://localhost:8000/graphql
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for graphene-crud-maker-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9485facb33030d33c395fd6499112186a96f94ca3b5482ff53ff1e8ecc84cc57 |
|
MD5 | e53dfd93f1e33a4ae26716c94a531b8e |
|
BLAKE2b-256 | 71b74c7d896dae271c278d72cb17c4c716371202eccb1ff6d161b5f1e08d7a49 |
Close
Hashes for graphene_crud_maker-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b50c5b596bad3713bd213c59550d3ecc0ee4299087ce2e6a7d70db67e1cb79c |
|
MD5 | c6f69c96e6ed64488152f1f661944488 |
|
BLAKE2b-256 | f58ee01b742855e451b2054700dd5609348b2080d1721d95c503e86a737a0fe3 |