Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.09 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.09 KB

Simple Example Project

Simple project demonstrating the use of pydgraph, the official python client for Dgraph.

Running

Start Dgraph

Store the following content in docker-compose.yml. Then, run docker-compose up to set up the Dgraph cluster:

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    restart: on-failure
    command: dgraph zero --my=zero:5080
  server:
    image: dgraph/dgraph:latest
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=server:7080 --zero=zero:5080 --security "whitelist=${WHITELISTED}"

The "WHITELISTED" environment variable can be intiialized as described in this post. We need to whitelist these IPs because the docker container runs with it's own IP address.

Install the Dependencies

pip install -r requirements.txt

Run the Sample Code

python simple.py

You can explore the source code in the simple.py file.