A GraphQL server boilerplate, built in Django.
A GraphQL, Django server boilerplate built with Graphene.
- Reporters -> Articles dataloader query
- Articles -> Reporter dataloader query
- Authentication and permission control
- Hosted on Heroku
- Sentry integration
- Tested with Pytest
- Basic rate limiting
- Renovate bot
- Caching
pipenv sync --dev
To run this project with docker:
docker-compose up -d --build
# Database migration
pipenv run python3 django_graphene_starter/manage.py migrate
# Run GraphQL server at localhost:8000 by default
pipenv run python3 django_graphene_starter/manage.py runserver
# Run GraphQL server with gunicorn
gunicorn --chdir django_graphene_starter django_graphene_starter.wsgi
pipenv run python3 django_graphene_starter/manage.py shell_plus
python3 django_graphene_starter/manage.py list_model_info --field-class
Read more about using Insomnia for API development here.
mixer is used to generate fixtures for this project.
# To generate fixtures
python3 django_graphene_starter/manage.py generate_fixtures -r 1000 -a 10 -p 10
# To delete all data
python django_graphene_starter/manage.py flush
pipenv run pytest django_graphene_starter
- https://medium.com/open-graphql/solving-n-1-problem-with-dataloader-in-python-graphene-django-7a75d6c259ba
- https://github.com/mirumee/saleor/blob/master/saleor/product/models.py#L452
- https://github.com/mirumee/saleor/blob/master/saleor/graphql/product/dataloaders/products.py#L41
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change
Before you begin your development work, make sure you have installed pre-commit hooks.
Some example useful invocations:
pre-commit install
: Default invocation. Installs the pre-commit script alongside any existing git hooks.pre-commit install --install-hooks --overwrite
: Idempotently replaces existing git hook scripts with pre-commit, and also installs hook environments
- Fork this
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request