Skip to content

a django api wrrapping a database containing alignment data

License

Notifications You must be signed in to change notification settings

Clear-Bible/alignment-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A prototype API for accessing alignment data. Built with Django. Serves up data from Clear-Bible/Alignments.

Local Development

Run Frontend

In the client/ directory...

Install dependencies

npm install

Start local server

npm run dev

...

Run Backend

In the server/ directory...

Install dependencies

poetry install

Optional: Use PostgreSQL

createdb alignmentapi
export DATABASE_URL=postgres://localhost/alignmentapi

Run initial migrations

poetry run ./manage.py migrate

Populate alignment database

runtime ~20 mins

poetry run ./manage.py shell < alignment_api/pipelines/load_alignments.py

Start local server

poetry run ./manage.py runserver

Deploy Backend

  • Get access to the app on Heroku
  • Authenticate using the Heroku CLI:
heroku login
  • Link the site to the Heroku app:
heroku git:remote -a clear-alignment-api
  • Deploy via Git push
git push heroku <branch-name>:main

Update Data on Heroku

  • Put site into maintenance mode
heroku maintenance:on
  • Reset the existing database
heroku pg:reset DATABASE --confirm clear-alignment-api
  • Push local database up to Heroku
heroku pg:push alignmentapi DATABASE
  • if using db auth locally...
heroku pg:push $(echo $DATABASE_URL) DATABASE
  • Take site out of maintenance mode
heroku maintenance:off
  • Browse to /alignment
open https://clear-alignment-api.herokuapp.com/alignment/