Clone this repository and rename the .env.example
in the root of the project to .env
Install requirements with the requirements.txt
file
$ pip install -r requirements.txt
make sure you're at the root of the project then run
$ docker-compose up
It will perform database migrations and the api will be served by gunicorn on http://localhost:8000
If you prefer not to use docker
$ python manage.py migrate && python manage.py runserver
A django management command python manage.py data_from_csv <csv_file>
exists to populate the database automatedly.
Usage example
$ python manage.py data_from_csv cars.csv
It will add car entries to the database utilizing the csv file cars.csv
already present at the root of this project
With the containers still running, run the following command to execute all test cases
$ docker exec -it cars-api python -m pytest
$ pytest