Skip to content

mit-spatial-action/who-owns-mass-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

who-owns-mass-backend

Django backend for who owns mass application.

DB Schema

mass_evictions schema

Setup

Written in Python 3.10.2

Install pyenv-virtualenv

Create the virtual Python environment:

pyenv virtualenv 3.10.2 mass-evictions

Trigger it automatically upon cd-ing into current dir

echo "mass-evictions" >> .python-version

Install Python dependencies:

pip install requirements.txt

To run app:

./manage.py runserver

Create a local settings file

cp config/settings/settings_local.example.py config/settings/settings_local.py

Update Database

Run sql file update_db.sql either by running file or copy pasting each line and making sure the tables have been updated with an id column

psql \c eviction_db
\dt
\x on;
select * from plaintiffs limit 5;

Migrate DB

./manage.py migrate     

to run Django shell (and make it nice)

./manage.py shell_plus

To visualize database schema

pip install pygraphviz
python manage.py graph_models -a -g -o schema.png