Application to test out using GraphQL in Django.
Built with Python3.
- Python 3.7
- Django 2.2
git clone https://github.com/taiyeoguns/django-graphql-trial.git
If not already installed, install Pipenv
Create virtual environment and install the application requirements:
pipenv install
Thereafter activate environment by running:
pipenv shell
To deactivate environment, run:
exit
Create .env
file from example file and maintain necessary details in it.
cp .env.example .env
Create tables in the database:
python manage.py migrate
To populate database with sample data, run:
python manage.py seed
Start the application by running:
python manage.py runserver
Open a browser and navigate to http://localhost:8000/graphql
In Graphiql, enter the following sample requests:
query {
departments {
id
name
createdAt
}
}
query {
employees {
id
firstName
lastName
department {
id
name
}
createdAt
}
}
In command prompt, run:
pytest -v