Skip to content

artemjasan/restaurant_visits_diary

Repository files navigation

Diary of visits to restaurants

REST API JSON Python project which allows users creation of restaurants and visit notes to them.

Start here

This is the api part of the Diary of restaurants.

For that project I've used the following technologies:

This is the start point of your journey on this project. For convenience, I tried to use the containerization, which provides by Docker and Docker Compose. It can significantly isolate and unify process on all machines, but before using Docker, you have to complete several steps:

Install poetry package manager to your machine

$ pip install poetry

Activate poetry

$ poetry shell

Install dependencies to venv

$ poetry install

Launch application by Docker/Docker Compose

Firstly you need to create a local.env file in root directory. It can be empty, because by default, Django uses default values for the environment variables. But, if you want to customize them, just add required environment variables to local.env file.

Next step is build Docker image:

Via docker-compose

$ docker-compose build
$ docker-compose up --no-start
$ docker-compose run --rm web python restaurant_visits_project/manage.py migrate
$ docker-compose up

Via make

$ make first-launch

How to use the application

Firstly you should register a new user and login, because the application has basic authentication system, which based on JWT:

Registration

http://0.0.0.0:8000/api/auth/registration/

Login

http://0.0.0.0:8000/api/auth/login/

Application Routes

Swagger was used for autogenerated of documentation. You can find everything there:

Autogenerated documentation

http://0.0.0.0:8000/api/schema/swagger/

http://0.0.0.0:8000/api/schema/redoc/

No type of serializer is used for the Crypto endpoint, so the auto-documentation may not be complete.

  • for listing all crypto coins GET method:

http://0.0.0.0:8000/api/v1/crypto/

  • for get the required crypto coin GET method:

http://0.0.0.0:8000/api/v1/crypto/?name=<coin name>

Testing

To run the tests I also use the containerization provided by Docker.

Via docker-compose

$ docker-compose run --rm web pytest

after the tests pass, it is necessary to stop the work of containers.

$ docker-compose stop

Via make

$ make test

Additional tools

pre-commit and other checkers (flake8, mypy, isort, black)

Before starting, you have to install the git hook scripts:

$ pre-commit install

Now pre-commit will run automatically on git commit, or you can launch it manually:

$ pre-commit run --all-files

About

Entry task to Python Backed Developer (Django/DRF)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages