Pand-Aid / pandaid-api

backend for Pand-Aid pandemic response app
3 stars 3 forks source link

pandaid-api

[![Build Status](https://travis-ci.org/Pand-Aid /pandaid-api.svg?branch=master)](https://travis-ci.org/Pand-Aid /pandaid-api) Built with

REST API backend for Pand-Aid pandemic response app.

Check out the project's Main README for more information.

Prerequisites

Local Development

All commands in bash regardless of operating system unless otherwise noted

mac

Homebrew installations:

$ brew install docker-compose

setup

The first time you work on this, build the docker image:

docker-compose build

Then start it with

docker-compose up

Then get a shell in the docker container and create a superuser

$ docker exec -ti pandaid-api_web_1 /bin/bash
:/code# python manage.py createsuperuser --email admin@example.com --username admin

windows

setup

The first time you work on this, build the docker image:

docker-compose build

Then start it with

docker-compose up

Then get a shell in the docker container and create a superuser

$ winpty docker exec -it pandaid-api_web_1 //bin/sh
:/code# python manage.py createsuperuser --email admin@example.com --username admin

You can get an authentication token by sending a POST request to http://localhost:8000/api-token-auth/ with the superuser credentials in a formdata labeled username and password.

For example, you can send the POST request as a cURL request:

curl --location --request POST 'localhost:8000/api-token-auth/' \
--header 'Content-Type: multipart/form-data' \
--form 'username=<username>' \
--form 'password=<password>'

or via an app such as Postman.

running

Start the dev server for local development:

docker-compose up

(hide server logs by adding the -d flag)

Run a command inside the docker container:

docker-compose run --rm web [command]

Contributing

Check out our Contribution Guidelines if you are interested in helping with this project

How to File an Issue

Notice an issue in our code or documentation? Is there a new feature you would like to see implemented?

As a first step checkout our How To File an Issue guide