Skip to content

The second selection task for Yandex Backend School 2021

Notifications You must be signed in to change notification settings

atsanda/candy-shop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Candy Shop

codecov

This is a small REST service written with Django REST framework for managing couriers and orders for a candy shop. It is a part of selection process to Yandex Backend School.

Structure

The app implements several APIs:

[POST] /couriers
[GET] /couriers/{courier_id}
[PATCH] /couriers/{courier_id}
[POST] /orders
[POST] /orders/assign
[POST] /orders/complete

There are several core files for processing each of them:

  • a request is recieved inside views,
  • then deserialized and validated inside serializers,
  • business logic is applied from services,
  • complex queries are moved to models.

Installation

To install the app for development

  • install python>=3.7
  • install dependencies from requirements.txt, it is better to do it inside virtual environment
$ python -m venv env
$ . env/bin/activate
$ pip install -r requirements.txt
  • after that make sure you have Postgres installed (I used v.11)
  • use default config for postgres
  • create candy_shop db
  • create .env
DJANGO_SETTINGS_MODULE=candy_shop.config
DJANGO_CONFIGURATION=Local
  • run tests to check your installation
$ pytest

Deployment

The app was deployed to the corresponding virtual machine, which was given to all entrants. My setup for deployment were taken from this video. The video offers to deploy through gunicorn, nginx and supervisor, which I did.

Tests

PyTest was used for testing. So far, only integration tests have been written.

About

The second selection task for Yandex Backend School 2021

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages