This example project demonstrate an integration between Graphene and Django. You'll build an Event Model to access event objects through GraphQL.
First you'll need to get the source of the project. Do this by cloning the repository:
# Get the project code
git clone https://github.com/Moesif/moesif-graphene-django-example.git
NOTE: While working with Python, we would recommend to use virtual environment to keep all the project's dependencies isolated from other projects.
conda create -n graphql python=3.6 anaconda # Create the environment
source activate graphql # Activate the environment
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
$ python manage.py shell
>>> from events.models import Event
>>> Event.objects.create(name='API Analytics', url='https://www.moesif.com/')
>>> Event.objects.create(name='Trove Marketplace', url='https://www.trove.com/')
python manage.py runserver
Go to localhost on Insomnia or your favorite browser to Create/Search/Filter data through GraphQL. More detail on how to write your first query and mutation could be found here.