The UNICEF eTools repo represents the backend of the eTools application. In order to see the full application in action, ignore this document and instead follow the steps in the etools-infra README.
Some developers, however, may wish to focus only on the backend. If so, these instructions will help you get the backend running on your laptop without needing Docker or any of the other frontend applications. This will allow you to run tests, use the Django shell, and view the Django admin.
These instructions assume you are starting with Ubuntu 16.04.
This step is unnecessary if you already have Python 3.6, Postgres 9.5, and PostGIS 2.2 installed on your machine.
$ sudo apt update
$ sudo apt install python3.6-dev python3-pip virtualenv libgdal-dev \
postgresql postgresql-9.5-postgis-2.2 libpq-dev \
libpgpool0 pgpool2 postgresql-9.5-pgpool2
This step is unnecessary if your user can create databases, and if you already have installed some commonly used extensions into your template1 database.
$ sudo -u postgres createuser <your-username> --createdb
$ sudo -u postgres psql template1 -c "create extension postgis;"
$ sudo -u postgres psql template1 -c "create extension pg_trgm;"
This step is unnecessary if you have already installed virtualenvwrapper previously.
Add the following statements to your .profile
. See the virtualenvwrapper
documentation
for details on the values you should use.
$ pip install virtualenvwrapper
$ source virtualenvwrapper.sh
$ git clone [email protected]:unicef/etools.git
$ cd etools/EquiTrack/
Installing GDAL requires us to point to the proper location of the GDAL header files.
$ export CPLUS_INCLUDE_PATH=/usr/include/gdal
$ export C_INCLUDE_PATH=/usr/include/gdal
$ mkvirtualenv -p `which python3.6` etools
(etools)$ pip install -r requirements/local.txt
(etools)$ createdb etools
(etools)$ python manage.py migrate_schemas --noinput
(etools)$ python manage.py createsuperuser
(etools)$ python manage.py runserver
(etools)$ ./runtests.sh
(etools)$ ./runtests.sh partners