Skip to content

user-Roma/yamdb_final

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

"YaMDb"

Description

This is a RESTful API for "YaMDb", a rating service for artworks like movies, books or songs.

Technology

Python Django Django REST Framework PostgreSQL JWT Nginx gunicorn Docker Docker-compose Docker Hub Workflow

.env template

DB_ENGINE=foo
DB_NAME=fooo
POSTGRES_USER=fooo
POSTGRES_PASSWORD=foooo
DB_HOST=db
DB_PORT=5432
DJANGO_SECRET_KEY='foooo'
DJANGO_ALLOWED_HOSTS=*

How to run the project in dev-mode

  • clone this repository to your local machine
git clone git@github.com:user-Roma/yamdb_final.git
  • create a virtual environment
python3 -m venv venv
  • activate virtual environment
source venv/bin/activate
  • upgrade pip
python3 -m pip install --upgrade pip
  • install dependencies in requirements.txt
pip install -r api_yamdb/requirements.txt
  • inside the folder with manage.py file execute the following command for migrations:
python3 manage.py migrate
  • inside the same folder execute this command to create a superuser:
python3 manage.py createsuperuser
  • inside the same folder execute this command to start the development server:
python3 manage.py runserver

Command description for launching applications in Docker-compose

  • run docker
sudo systemctl start docker
  • create and start containers from the directory ./infra/
sudo docker-compose up --build

Commands for filling the database, run from the remote server: cloud-touch-01@130.193.41.106

  • run migrations
sudo docker-compose exec web python manage.py makemigrations
sudo docker-compose exec web python manage.py migrate
  • collect the static files
sudo docker-compose exec web python manage.py collectstatic --no-input
  • OPTIONAL: copy test data to remote server from the directory ./infra/
sudo scp test_database.json cloud-touch-01@130.193.41.106:/home/cloud-touch-01/
  • OPTIONAL: copy test data into docker container
sudo docker cp test_database.json <CONTAINER>:app/test_database.json
  • OPTIONAL: load test database into yamdb project
sudo docker-compose exec web python manage.py loaddata test_database.json
  • create superuser
sudo docker-compose exec web python manage.py createsuperuser

REST API available endpoints

After you started the development server, go to http://130.193.41.106/api/redoc/ URL where you can find the API documentation with available endpoints.

Authors

RomanS, AlexanderK, RomanY

About

yamdb_final

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages