These instructions are tested on a Mac M1. Shouldn't be that different on Linux. If you're on Windows, I'm sorry, but I have no idea how you can setup your environment. Google will be your friend.
- PSQL server running
- Redis server running
- Python 3.8:
brew install [email protected]
- Flak 8 installed:
brew install flake8
- Black installed:
brew install black
- GDAL installed:
brew install gdal
- PROJ installed:
brew install proj
- postgis installed:
brew install postgis
- watchman
brew install watchman
- Copy
.env.local.example
and rename it to.env.local
- Update the env variables to match your local config
- Copy the file
pre-push
to.git/hooks/pre-push
:cp pre-push .git/hooks/pre-push
Install PSQL spatial extension https://docs.djangoproject.com/fr/3.2/ref/contrib/gis/install/postgis/
Setup DB user:
ALTER ROLE localuser SET client_encoding TO 'utf8'; ALTER ROLE localuser SET default_transaction_isolation TO 'read committed'; ALTER ROLE localuser SET timezone TO 'UTC';
Grant privileges to local DB user:
GRANT ALL PRIVILEGES ON DATABASE estimer TO localuser; ALTER ROLE localuser SUPERUSER;
- Create a virtual environment
at
/estimer
python3.9 -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install dependencies
pip install -r requirements/local.txt
- Import dvf data to your local DB
python manage.py shell
from src.dvf.aggregator.data_import import import_data for year in range(2016,2021): import_data(year)
- Import iris data to your local DB
python manage.py shell
from src.iris.aggregator.data_import import import_data import_data(2021)
- Fill
geometry_4326
column in your database From a psql prompt:UPDATE iris_iris SET "geometry_4326" = ST_Transform(geometry,4326)
- Import dvf_mutationiris from DB dump
TODO: add prod setup guide