-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from atsanda/feat-readme
(feat) readme
- Loading branch information
Showing
1 changed file
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |