Photo managing backend application

The task content is in the TASK.md file.

Requirements

Install libraries / dependencies

pip install -U pip
pip install -r requirements.txt

Run server

./manage.py migrate
./manage.py runserver

Run tests

Install dev requirements:

pip install -r requirements-dev.txt

Run tests:

./manage.py test

Run tests with coverage:

coverage run --source=api,photos manage.py test
coverage report

Endpoints

/api/photos/

  • GET: List all photos
  • POST: Create a new photo

/api/photos/{int:id}

  • GET: Retrieve a photo
  • PUT: Update a photo
  • PATCH: Partial update a photo
  • DELETE: Delete a photo

photos/import/

  • POST: Upload photos from external api

Example requests are included in requests.http file.

CLI

To show help:

./manage.py load_batch --help

Example usage:

./manage.py load_batch --url https://jsonplaceholder.typicode.com/photos
./manage.py load_batch --file /path/to/file.json