Skip to main content

GraphQL implementation for countries

Project description

Pypi Wheel Build Status Codecov Code Climate

Countries support for Django GraphQL

Dependencies

  • Python ≥ 3.4
  • Django ≥ 1.11
  • PostGIS database (PostgreSQL ≥ 9.4)

Installation

Install last stable version from Pypi.

pip install django-graphql-countries

Add countries to your INSTALLED_APPS settings:

INSTALLED_APPS = [
    ...
    'countries.apps.CountriesAppConfig',
]

Apply migrations:

python manage.py migrate

Load data

The loadcountries management command read all fixtures and re-loaded into the database:

python manage.py loadcountries

Schema

Add queries to your GraphQL schema

import graphene
import graphql_countries


class Query(graphene.ObjectType, graphql_countries.Query):
    """GraphQL Queries"""


schema = graphene.Schema(query=Query)

Query

Countries GeoJSON outlines:

query {
  countries {
    capital
    mpoly {
      type
      coordinates
    }
  }
}

Relay

Complete support for Relay.

import graphene
import graphql_countries


class Query(graphene.ObjectType, graphql_countries.relay.Query):
    """Relay Queries"""


schema = graphene.Schema(query=Query)

Query

GeoJSON outlines for 🇻🇳 Vietnam:

query {
  countries(cca2: "VN") {
    edges {
      node {
        capital
        mpoly {
          type
          coordinates
        }
      }
    }
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_graphql_countries-0.0.5-py2.py3-none-any.whl (8.3 kB) Copy SHA256 hash SHA256 Wheel 3.6 Jan 30, 2018
django-graphql-countries-0.0.5.tar.gz (5.5 kB) Copy SHA256 hash SHA256 Source None Jan 30, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page