Skip to content

NotMainCode/yamdb_final

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API of project "YaMDb".

yamdb workflow

Description

The YaMDb project collects user feedback on creations (Title). The creations are divided into categories: "Books", "Films", "Music", etc. The list of categories can be expanded by the administrator.

In each category there is information about the creations. The creations themselves are not stored in YaMDb; you cannot watch a movie or listen to music here.

A creation can be assigned a genre from the preset list. New genres can only be created by the administrator.

Users can leave text reviews for creations and rate the creation in the range from one to ten (an integer); from user ratings, an average rating of the creation is formed - rating (integer). A user can leave only one review per creation.

Temporary links

YaMDb Admin Site

YaMDb API documentation

Examples of requests

  • user registration (POST)

api/v1/auth/signup/

{
   "username": "my_username",
   "email": "my_email"
}
  • getting access JWT-token (POST)

api/v1/auth/token/

{
   "username": "my_username",
   "confirmation_code": "my_confirmation_code"
}

Triggers of GitHub Actions workflow

  • push to any branch - running flake8 and functional tests
  • push to master branch - pushing the app image to the DockerHub repository, running project on remote server, sending Telegram message about the successful completion of the workflow. Django app: collectstatic, migrate

Technology

Python 3.7

Django 2.2.28

Django REST framework 3.12.4

Simple JWT 5.2.1

Docker 20.10.22

Docker Compose 2.14.2

PostgreSQL 13.0-alpine

Nginx 1.21.3-alpine

GitHub Actions

Launch

DOCKER_USERNAME=<docker_username>
DOCKER_PASSWORD=<docker_password>
DOCKER_REPO=<docker_username>/<image name>
SERVER_HOST=<server_pub_ip>
SERVER_PASSPHRASE=<server_passphrase>
SERVER_USER=<username>
SSH_KEY=<--BEGIN OPENSSH PRIVATE KEY--...--END OPENSSH PRIVATE KEY--> # cat ~/.ssh/id_rsa
TELEGRAM_TO=<telegram_account_ID> # https://telegram.im/@userinfobot?lang=en
TELEGRAM_TOKEN=<telegram_bot_token> # https://t.me/botfather


- ENV_FILE variable value

DB_ENGINE=django.db.backends.postgresql
POSTGRES_DB=<database name>
POSTGRES_USER=<username>
POSTGRES_PASSWORD=<password> 
DB_HOST=db
DB_PORT=5432
DJANGO_SECRET_KEY=<Django_secret_key>
DOCKER_REPO=<docker_username>/<image name>
SERVER_HOST=<server_pub_ip>
SERVER_URL=http://<server_pub_ip>/admin
  • Copy docker-compose.yaml file and nginx folder to the server.
scp <path_to_file>/docker-compose.yaml <username>@<server_pub_ip>:/home/<username>
scp -r <path_to_folder>/nginx <username>@<server_pub_ip>:/home/<username>
  • Connect to the server.
ssh <username>@<server_pub_ip>

Install docker and compose plugin. Follow the steps after installing Docker Engine.

After activation and successful completion of the GitHub Actions workflow, the project is available at: http://<server_pub_ip>/admin/

  • Create superuser
docker compose exec web python manage.py createsuperuser
  • Enter test data into the database
docker compose exec web python manage.py loaddata db_fixtures.json
  • Create a database dump
docker compose exec web python manage.py dumpdata > db_dump.json

Authors

NotMainCode - Auth, Users, containerization, CI/CD

Vas1l1y - Titles, Categories, Genres

SerMikh1981 - Reviews, Comments, import data from CSV files

About

yamdb_final

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages