The API rides on Google App Engine Python 2.7 runtime, so we just need to download the latest Python SDK (grab the Linux version) and add it to our PATH.
Then checkout the repo:
$ git clone git@github.com:wri/gfw-api.git
Developers Note: If you are developing you'll also need the following files added to project root: privatekey.pem, ee_assest_ids.json, prod.json, dev.json. Please contact Adam Mulligan or David Gonzalazez for this.
We can now run it locally using the development server that ships with App Engine:
cd gfw-api
pip install -r requirements.txt.
dev_appserver.py .
It's now running locally at http://localhost:8080 and you get an admin console at http://localhost:8080/_ah/admin. Here's an example call:
We use Nose which extends Python's unittest functionality to make things easier. First install the requirements:
Now we can run all the tests:
nosetests --with-gae --without-sandbox test/
Alternatively we can run a specific test:
nosetests --with-gae --without-sandbox test/gfw/forestchange/api_test.py
To deploy to App Engine:
appcfg.py update -V master -M default --oauth2 .
appcfg.py update -V develop -M staging --oauth2 .
Backups of Subscriptions in the Google Cloud Datastore are run automatically
every 12 hours, and are stored in a Google Cloud Storage You can change this
time schedule in cron.yaml
.
This document is useful if you need to make any changes: https://cloud.google.com/appengine/articles/scheduled_backups?hl=en