This document explains how you can install the API for accessing the database. To deploy the website, see Install development environment.
We assume you know a little of Python and know how to install Python packages in your computer using pip.
Getting the source¶
git clone https://github.com/jorgecarleitao/public-contracts.git
Like most Python code, the source doesn’t need to be installed; you just have to put it somewhere in your computer.
You need Python 3.
For using the code, you need to install three python packages:
We use Django ORM to abstract ourselves of the idea of database and use Python classes to work with the data:
pip install Django
Our remote database is in postgres. To Python communicate with it, we need a binding:
pip install psycopg2
Running the example¶
Once you have the dependencies installed, enter in its directory and run:
python -m contracts.tools.example
If everything went well, it outputs two numbers:
- the total number of contracts in the database, that you can corroborate with the official number.
- the sum of the values of all contracts.
If some problem occur, please add an [issue](https://github.com/jorgecarleitao/public-contracts/issues) so we can help you and improve these instructions.