Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

GraphQL implementation for countries

Project description

Pypi Wheel Build Status Codecov Code Climate

Countries support for Django GraphQL and Relay

Dependencies

  • Python ≥ 3.5
  • 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)

GeoJSON query

GeoJSON outlines for 🇻🇳Vietnam:

query {
  countries(cca2: "VN") {
    edges {
      node {
        cca2
        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.

Files for django-graphql-countries, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size django_graphql_countries-0.0.3-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size django-graphql-countries-0.0.3.tar.gz (6.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page