Skip to content

joaorafaelm/graphql-django-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL and Django example

This project is an example of GraphQL and Django, using graphene-django. You can read the post explaining this project here.

Installation

1. Download

First, download the graphql-django-example project files to your workspace:

$ git clone https://github.com/joaorafaelm/graphql-django-example;
$ cd graphql-django-example;

2. Virtualenv

We're going to use a virtual environment to easily manage dependencies for this demo. If you're not yet familiar with virtual environments for Python, using virtualenv, take a moment to learn about them. If you're already familiar with the concept, create one for the project:

$ virtualenv venv;
$ source venv/bin/activate;

3. Requirements

The requirements.txt file specifies the versions of django, and graphene-django, I'd like you to install. To do this, installing them into your virtual environment, type:

$ pip install -r requirements.txt

Initialize the database

./manage.py migrate

Load some data

./manage.py loaddata books.json

If you wish to add more data, run ./manage.py createsuperuser, and you can use the admin interface, at /admin, after the runserver step below.

4. Ready? Go!

./manage.py runserver

Visit the link returned by runserver and visit the graphql route. This is likely to look like "http://127.0.0.1:8000/graphql."

Releases

No releases published

Packages

No packages published

Languages