Skip to content

Codebase for backend that supports the mentee program from BRASA

Notifications You must be signed in to change notification settings

gobrasa/brasa-pre

Repository files navigation

Brasa Pre

CircleCI

Starting app locally

To run from command-line:

cd backend
python app.py

Or to run locally with Heroku (not recommended):

heroku local web

Running tests locally

pytest

Or to run a specific test:

pytest tests/test_database.py

Adding a new model in database

  • Add class to models.py file (add tablename, columns, relationships)

  • Create .env file

cd backend 
echo DATABASE_URL='"postgresql://localhost/brasa_pre5"' > .env
  • Create migration by initialising the migrations directory once:
cd backend
python backend/manage.py db migrate -m "created initial tables"

If any db operations need to be added, add manually to the .py file created inside the migrations folder.

The database in Heroku will execute the upgrade script when deploying upon release of a new version. If running locally, run:

python backend/manage.py db upgrade

This will create tables and/or upgrade columns in the Postgres DB.

Deploying to Heroku

git push heroku master

Deployment to CircleCI

TBD