Skip to content

Commit

Permalink
Merge pull request #5 from atsanda/feat-readme
Browse files Browse the repository at this point in the history
(feat) readme
  • Loading branch information
atsanda authored Mar 25, 2021
2 parents b5cc8a3 + 581c2e8 commit 8c1eef5
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
[![codecov](https://codecov.io/gh/atsanda/candy-shop/branch/main/graph/badge.svg?token=YYQ675YF3V)](https://codecov.io/gh/atsanda/candy-shop)
# Candy Shop

[![codecov](https://codecov.io/gh/atsanda/candy-shop/branch/main/graph/badge.svg?token=YYQ675YF3V)](https://codecov.io/gh/atsanda/candy-shop)

This is a small REST service written with [Django REST framework](https://www.django-rest-framework.org/) for managing couriers and orders for a candy shop. It is a part of selection process to [Yandex Backend School](https://yandex.ru/promo/academy/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](candy_shop/apps/delivery/views.py),
* then deserialized and validated inside [serializers](candy_shop/apps/delivery/serializers.py),
* business logic is applied from [services](candy_shop/apps/delivery/services.py),
* complex queries are moved to [models](candy_shop/apps/delivery/models.py).

## 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
```bash
$ python -m venv env
$ . env/bin/activate
$ pip install -r requirements.txt
```
* after that make sure you have [Postgres](https://www.postgresql.org/download/) installed (I used v.11)
* use default config for postgres
* create `candy_shop` db
* create `.env`
```.env
DJANGO_SETTINGS_MODULE=candy_shop.config
DJANGO_CONFIGURATION=Local
```
* run tests to check your installation
```.bash
$ 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](https://youtu.be/FLiKTJqyyvs). The video offers to deploy through gunicorn, nginx and supervisor, which I did.

## Tests

[PyTest](https://docs.pytest.org/en/stable/) was used for testing. So far, only integration tests have been written.

0 comments on commit 8c1eef5

Please sign in to comment.