| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An API to explore the OpenSpending database.
The API is written in Python 3 and uses Flask blueprints.
Clone the repo, install dependencies from pypi, and run the server.
For development, create a .env file and add environmental variables:
# Address for the postgres instance, e.g. postgresql://postgres@db/postgres
OS_API_ENGINE=postgresql://postgres@db/postgres
# Address of elasticsearch server
OS_ELASTICSEARCH_ADDRESS=localhost:9200
# Address of Redis instance
OS_API_CACHE=redis
# Check health of ElasticSearch before starting app (optional)
OS_CHECK_ES_HEALTHY='True'With the backing services available, a development server can be started with: python dev_server.py
You need a few services running, namely Elasticsearch v5.x running on localhost:9200 and PostgreSQL.
Then set a few environment variables (your DB connection string might vary):
$ export OS_API_ENGINE=postgresql://postgres@/postgres
$ export DPP_DB_ENGINE=postgresql://postgres@/postgres
$ export OS_ELASTICSEARCH_ADDRESS=localhost:9200
$ export ELASTICSEARCH_ADDRESS=localhost:9200Install a few dependencies:
$ npm install -g os-types
$ sudo apt-get install libleveldb-dev libleveldb1 libpq-dev python3-dev
$ pip3 install tox coveralls 'datapackage-pipelines[speedup]>=2.0.0' 'datapackage-pipelines-fiscal>=1.2.0' psycopg2-binary
# or for MacOS
$ npm install -g os-types
$ brew install leveldb
$ pip3 install tox coveralls 'datapackage-pipelines[speedup]>=2.0.0' 'datapackage-pipelines-fiscal>=1.2.0' psycopg2-binaryFill the local DB with a sample fiscal data:
$ cd tests/sample_data && dpp run --verbose --concurrency=8 all
Then run:
$ tox| Back | FazBrowse Home | New Git URL |