sfbrigade/lighten-api

Name: lighten-api

Owner: SFBrigade

Description: Lighten is a web-based tool for social service providers to store, update, and exchange social services information through a universal standard. We are solving the problem of quickly getting the right help to the right people, by making it easy to get the right information to the right people.

Created: 2016-02-18 16:03:16.0

Updated: 2017-03-18 19:52:30.0

Pushed: 2016-12-12 00:27:22.0

Homepage: https://github.com/sfbrigade/lighten/wiki

Size: 482

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

lighten-api

CircleCI

This repo contains the Lighten API which runs on Heroku at https://lighten-api.herokuapp.com/.

Initial Setup

The steps here only need to be run once.

  1. Install Docker for Mac from https://docs.docker.com/docker-for-mac/

  2. Install the Heroku CLI

     brew install heroku
    
  3. Clone the lighten-api repo and submodules

     git clone git@github.com:sfbrigade/lighten-api.git
     cd lighten-api
     git submodule update --init --recursive
    
  4. Create an .env file for holding environment variables

     echo "SECRET_KEY=$(openssl rand -hex 24)" > .env
    
  5. Bring up the development services

     docker-compose up -d
    
  6. Initialize the database

     docker-compose exec api python manage.py migrate
    
  7. Load initial data via fixtures

     docker-compose exec api python manage.py loaddata lighten_api/organization
    
  8. Create a superuser

     docker-compose exec api python manage.py createsuperuser
    
  9. Stop the development services

     docker-compose stop
    
Development
  1. Bring up the development services

     docker-compose up --build
    

    The --build option ensures any new dependencies are included.

  2. Open the development API

     open http://localhost:8080
    
  3. Run tests as needed

     docker-compose exec api python manage.py test
    
Migrations

If you make any changes to the data models, you'll need to commit migrations

docker-compose exec api python manage.py makemigrations
git add */migrations
git commit
Production
  1. Deploy to Heroku

     git push heroku master
    
  2. Open the production API

     heroku open
    
Migrations

If you made any changes to the data models, you'll need to apply migrations

heroku run python manage.py migrate
Importing datasets from the data repo
Development
docker-compose exec api bin/import-dataset development
Production
docker-compose exec api bin/import-dataset production
Documentation

For more information about using Python and Docker on Heroku, see these Dev Center articles:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.