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.
Python Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
data @ 624b3e5
lighten
lighten_api
.dockerignore
.gitignore
.gitmodules
Dockerfile
LICENSE
NOTICE
Procfile
README.md
app.json
circle.yml
docker-compose.yml
manage.py
requirements.txt
runtime.txt

README.md

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: