This platform allows you to import RapidPRO data from multiple projects into a single place. It consumes RapidPro data via APIs and and re-serves that same data via those same APIs (but in aggregate). The current version is based off of the RapidPro V2 APIs.
To import and organization and all its data (once) run:
./manage.py sync_organization_data [apikey]
or
./manage.py sync_organization_data [apikey] --server https://myinstance.rapidpro.io
mkvirtualenv --no-site-packages rapidpro-dataapi
Make sure you are in the root directory of the repository then run:
pipenv install -d
If you need non-default settings, create a localsettings.py
file in data_api
.
Else you can use settings_dev
.
For all ./manage.py
commands, replace [settings module]
with whichever settings module you need, e.g. data_api.settings_dev
If you don't want to specify your settings module every time, just add
export DJANGO_SETTINGS_MODULE=data_api.localsettings
to your $VIRTUAL_ENV/bin/postactivate
file.
And add unset DJANGO_SETTINGS_MODULE
to $VIRTUAL_ENV/bin/predeactivate
to avoid it messing with other virtualenvs.
sudo -u postgres createdb rapidpro_data_api
./manage.py migrate --settings=[settings module]
./manage.py runserver --settings [settings module]
./manage.py test
Or to run individual tests:
./manage.py test data_api.staging.tests.test_data_import.DataImportTest.test_import_boundaries
Deployment is managed with fabric
.
To deploy to the UNICEF environment run:
fab production deploy
To deploy to another environment you can run
fab deploy
and manually specify the host at runtime.
For more information about the UNICEF production instance, see production.md.
For guides to accomplishing specific tasks see cookbooks.md.