Project allows to collect reviews on compositions. There is admin panel. Admin can create compositions (from API or admin panel), genres and categories. Users can write reviews on compositions and comment them. The project is hosted on the server 51.250.29.192
/api/v1/auth/signup/
POST
{
"username": "string", (required)
"email": "user@example.com", (required)
}
- YaMDB sending letter with verification code (confirmation_code) to email
/api/v1/auth/token/
POST
{
"username": "string", (required)
"confirmation_code": "user@example.com", (required)
}
- NOT NECESSARY
/api/v1/users/me/
PATCH
{
"username": "string",
"email": "user@example.com",
"first_name": "string",
"last_name": "string",
"bio": "string",
"role": "user"
}
api/v1/users/
GET
-- Permissions
Administrator
-- Parameters
search - looking for users
-- Responses
200, 401
api/v1/users/
POST
{
"username": "string", (required)
"email": "user@example.com", (required)
"first_name": "string",
"last_name": "string",
"bio": "string",
"role": "user"/"moderator"/"admin"
}
-- Permissions
Administrator
-- Responses
201, 400, 401, 403
api/v1/users/{username}
GET
-- Permissions
Administrator
-- Responses
200, 401, 403, 404
api/v1/users/{username}/
PATCH
{
"username": "string",
"email": "user@example.com",
"first_name": "string",
"last_name": "string",
"bio": "string",
"role": "user"
}
-- Permissions
Administrator
-- Responses
200, 400, 401, 403, 404
api/v1/users/{username}/
DELETE
-- Permissions
Administrator
-- Responses
204, 401, 403, 404
api/v1/categories/
GET
-- Permissions
All
-- Parameters
search - looking for category
-- Responses
200
api/v1/categories/
POST
{
"name": "string", (required)
"slug": "string" (required)
}
-- Permissions
Administrator
-- Responses
201, 400, 401, 403
api/v1/categories/{slug}/
DELETE
-- Permissions
Administrator
-- Responses
204, 401, 403, 404
api/v1/genres/
GET
-- Permissions
All
-- Parameters
search - looking for genre
-- Responses
200
api/v1/genres/
POST
{
"name": "string", (required)
"slug": "string" (required)
}
-- Permissions
Administrator
-- Responses
201, 400, 401, 403
api/v1/genres/{slug}/
DELETE
-- Permissions
Administrator
-- Responses
204, 401, 403, 404
api/v1/titles/
GET
-- Permissions
All
-- Parameters
filter by category, genre, name, year
-- Responses
200
api/v1/titles/
POST
{
"name": "string", (required)
"year": 0, (required)
"description": "string",
"genre": [
"string"
], (required)
"category": "string" (required)
}
-- Permissions
Administrator
-- Responses
201, 400, 401, 403
api/v1/titles/{titles_id}/
GET
-- Permissions
All
-- Responses
200, 404
api/v1/titles/{titles_id}/
PATCH
{
"name": "string",
"year": 0,
"description": "string",
"genre": [
"string"
],
"category": "string"
}
-- Permissions
Administrator
-- Responses
200, 401, 403, 404
api/v1/titles/{titles_id}/
DELETE
-- Permissions
Administrator
-- Responses
204, 401, 403, 404
api/v1/titles/{title_id}/reviews/
GET
-- Permissions
All
-- Responses
200, 404
api/v1/titles/{title_id}/reviews/
POST
{
"text": "string", (required)
"score": 1 (required)
}
-- Permissions
Authenticated Users
-- Responses
201, 400, 401, 404
api/v1/titles/{title_id}/reviews/{review_id}/
GET
-- Permissions
All
-- Responses
200, 404
api/v1/titles/{title_id}/reviews/{review_id}/
PATCH
{
"text": "string",
"score": 1
}
-- Permissions
Administrator, Moderator, Owner
-- Responses
200, 400, 401, 403, 404
api/v1/titles/{title_id}/reviews/{review_id}/
DELETE
-- Permissions
Administrator, Moderator, Owner
-- Responses
204, 401, 403, 404
api/v1/titles/{title_id}/reviews/{review_id}/comments/
GET
-- Permissions
All
-- Responses
200, 404
http://localhost/api/v1/titles/{title_id}/reviews/{review_id}/comments/
POST
{
"text": "string" (required)
}
-- Permissions
Authenticated Users
-- Responses
201, 400, 401, 404
api/v1/titles/{title_id}/reviews/{review_id}/comments/{comment_id}/
GET
-- Permissions
All
-- Responses
200, 404
api/v1/titles/{title_id}/reviews/{review_id}/comments/{comment_id}/
PATCH
{
"text": "string"
}
-- Permissions
Administrator, Moderator, Owner
-- Responses
200, 400, 401, 403, 404
api/v1/titles/{title_id}/reviews/{review_id}/comments/{comment_id}/
DELETE
-- Permissions
Administrator, Moderator, Owner
-- Responses
204, 401, 403, 404
- Python 3.8
- Django 2.2
- Django Rest Framework 3.12
- Docker
- PostgreSQL
Go to 51.250.29.192. It's all!
- Clone repository and going:
git clone ...
cd /infra
- Change nginx settings (servername)
- Create .env file (like template)
SECRET_KEY=... DEBUG=... ALLOWED_HOSTS=... DB_ENGINE=... DB_NAME=... POSTGRES_USER=... POSTGRES_PASSWORD=... DB_HOST=... DB_PORT=...
- Deploy and launch app:
docker-compose up -d --build
- Make migrations:
docker-compose exec web python manage.py migrate
- Fill database by data (optionally)
docker-compose exec web python manage.py loaddata fixtures.json
- Create superuser
docker-compose exec web python manage.py createsuperuser
- Collect static
docker-compose exec web python manage.py collectstatic --no-input
Kozhevnikov Aleksei