CCV API is a Django-based backed system to query the available CCVs.
- Python 3.7+: The language of choice.
- Django 3.0+: Framework used in this project.
- PostgreSQL: Relational Database of choice.
-
Clone the repository
git clone https://github.com/c3g/ccv_api.git
-
Create a virtual environment with Python 3 or later, and activate it
virtualenv venv -p python3 source venv/bin/activate
-
Install the dependencies required for this project
pip3 install -r requirements.txt
-
Create a new configuration file depending on the environment(development or production).
cp ccv_api/development.cfg.dist ccv_api/development.cfg
-
Create a new postgres database and configure credentials in the config file.
[database] NAME: db_name USER: db_user PASSWORD: password_for_user HOST: localhost PORT: 5432
-
Run migrations to migrate existing schema to the database
python3 manage.py migrate
After following all installation steps, Run the Django server
python3 manage.py runserver
If the installation is suceessful and Django server is running, then the parser can be executed
python3 manage.py parse_ccv <ccv_xml_file_path>
# For example
python3 manage.py parse_ccv sample_ccv/ccv_sample_3.xml
The above command takes the XML file as input and ingests the data into the database.
To run tests, run this command
tox -e pytest